commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
InvalidFieldErrorModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = 'InvalidField';
27  protected $code;
28 
33  protected $message;
34 
39  protected $field;
40 
45  protected $invalidValue;
46 
51  protected $allowedValues;
52 
57  protected $resourceIndex;
58 
59 
63  public function __construct(
64  ?string $message = null,
65  ?string $field = null,
66  $invalidValue = null,
67  ?array $allowedValues = null,
68  ?int $resourceIndex = null,
69  ?string $code = null
70  ) {
71  $this->message = $message;
72  $this->field = $field;
73  $this->invalidValue = $invalidValue;
74  $this->allowedValues = $allowedValues;
75  $this->resourceIndex = $resourceIndex;
76  $this->code = $code ?? self::DISCRIMINATOR_VALUE;
77  }
78 
83  public function getCode()
84  {
85  if (is_null($this->code)) {
87  $data = $this->raw(self::FIELD_CODE);
88  if (is_null($data)) {
89  return null;
90  }
91  $this->code = (string) $data;
92  }
93 
94  return $this->code;
95  }
96 
101  public function getMessage()
102  {
103  if (is_null($this->message)) {
105  $data = $this->raw(self::FIELD_MESSAGE);
106  if (is_null($data)) {
107  return null;
108  }
109  $this->message = (string) $data;
110  }
111 
112  return $this->message;
113  }
114 
121  public function getField()
122  {
123  if (is_null($this->field)) {
125  $data = $this->raw(self::FIELD_FIELD);
126  if (is_null($data)) {
127  return null;
128  }
129  $this->field = (string) $data;
130  }
131 
132  return $this->field;
133  }
134 
141  public function getInvalidValue()
142  {
143  if (is_null($this->invalidValue)) {
145  $data = $this->raw(self::FIELD_INVALID_VALUE);
146  if (is_null($data)) {
147  return null;
148  }
149  $this->invalidValue = $data;
150  }
151 
152  return $this->invalidValue;
153  }
154 
161  public function getAllowedValues()
162  {
163  if (is_null($this->allowedValues)) {
165  $data = $this->raw(self::FIELD_ALLOWED_VALUES);
166  if (is_null($data)) {
167  return null;
168  }
169  $this->allowedValues = $data;
170  }
171 
172  return $this->allowedValues;
173  }
174 
179  public function getResourceIndex()
180  {
181  if (is_null($this->resourceIndex)) {
183  $data = $this->raw(self::FIELD_RESOURCE_INDEX);
184  if (is_null($data)) {
185  return null;
186  }
187  $this->resourceIndex = (int) $data;
188  }
189 
190  return $this->resourceIndex;
191  }
192 
193 
197  public function setMessage(?string $message): void
198  {
199  $this->message = $message;
200  }
201 
205  public function setField(?string $field): void
206  {
207  $this->field = $field;
208  }
209 
213  public function setInvalidValue($invalidValue): void
214  {
215  $this->invalidValue = $invalidValue;
216  }
217 
221  public function setAllowedValues(?array $allowedValues): void
222  {
223  $this->allowedValues = $allowedValues;
224  }
225 
229  public function setResourceIndex(?int $resourceIndex): void
230  {
231  $this->resourceIndex = $resourceIndex;
232  }
233 }
__construct(?string $message=null, ?string $field=null, $invalidValue=null, ?array $allowedValues=null, ?int $resourceIndex=null, ?string $code=null)