commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DuplicateFieldErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = 'DuplicateField';
27  protected $code;
28 
33  protected $message;
34 
39  protected $field;
40 
45  protected $duplicateValue;
46 
47 
51  public function __construct(
52  ?string $message = null,
53  ?string $field = null,
54  $duplicateValue = null,
55  ?string $code = null
56  ) {
57  $this->message = $message;
58  $this->field = $field;
59  $this->duplicateValue = $duplicateValue;
60  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
61  }
62 
67  public function getCode()
68  {
69  if (is_null($this->code)) {
71  $data = $this->raw(self::FIELD_CODE);
72  if (is_null($data)) {
73  return null;
74  }
75  $this->code = (string) $data;
76  }
77 
78  return $this->code;
79  }
80 
85  public function getMessage()
86  {
87  if (is_null($this->message)) {
89  $data = $this->raw(self::FIELD_MESSAGE);
90  if (is_null($data)) {
91  return null;
92  }
93  $this->message = (string) $data;
94  }
95 
96  return $this->message;
97  }
98 
105  public function getField()
106  {
107  if (is_null($this->field)) {
109  $data = $this->raw(self::FIELD_FIELD);
110  if (is_null($data)) {
111  return null;
112  }
113  $this->field = (string) $data;
114  }
115 
116  return $this->field;
117  }
118 
125  public function getDuplicateValue()
126  {
127  if (is_null($this->duplicateValue)) {
129  $data = $this->raw(self::FIELD_DUPLICATE_VALUE);
130  if (is_null($data)) {
131  return null;
132  }
133  $this->duplicateValue = $data;
134  }
135 
136  return $this->duplicateValue;
137  }
138 
139 
143  public function setMessage(?string $message): void
144  {
145  $this->message = $message;
146  }
147 
151  public function setField(?string $field): void
152  {
153  $this->field = $field;
154  }
155 
159  public function setDuplicateValue($duplicateValue): void
160  {
161  $this->duplicateValue = $duplicateValue;
162  }
163 }
__construct(?string $message=null, ?string $field=null, $duplicateValue=null, ?string $code=null)