commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryCustomFieldAddedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
21use DateTimeImmutable;
22use stdClass;
23
28{
29 public const DISCRIMINATOR_VALUE = 'DeliveryCustomFieldAdded';
34 protected $id;
35
40 protected $version;
41
46 protected $createdAt;
47
52 protected $lastModifiedAt;
53
58 protected $lastModifiedBy;
59
64 protected $createdBy;
65
70 protected $sequenceNumber;
71
76 protected $resource;
77
83
88 protected $type;
89
95
100 protected $name;
101
106 protected $value;
107
112 protected $deliveryId;
113
114
118 public function __construct(
119 ?string $id = null,
120 ?int $version = null,
121 ?DateTimeImmutable $createdAt = null,
122 ?DateTimeImmutable $lastModifiedAt = null,
124 ?CreatedBy $createdBy = null,
125 ?int $sequenceNumber = null,
126 ?Reference $resource = null,
127 ?int $resourceVersion = null,
129 ?string $name = null,
130 $value = null,
131 ?string $deliveryId = null,
132 ?string $type = null
133 ) {
134 $this->id = $id;
135 $this->version = $version;
136 $this->createdAt = $createdAt;
137 $this->lastModifiedAt = $lastModifiedAt;
138 $this->lastModifiedBy = $lastModifiedBy;
139 $this->createdBy = $createdBy;
140 $this->sequenceNumber = $sequenceNumber;
141 $this->resource = $resource;
142 $this->resourceVersion = $resourceVersion;
143 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
144 $this->name = $name;
145 $this->value = $value;
146 $this->deliveryId = $deliveryId;
147 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
148 }
149
156 public function getId()
157 {
158 if (is_null($this->id)) {
160 $data = $this->raw(self::FIELD_ID);
161 if (is_null($data)) {
162 return null;
163 }
164 $this->id = (string) $data;
165 }
166
167 return $this->id;
168 }
169
176 public function getVersion()
177 {
178 if (is_null($this->version)) {
180 $data = $this->raw(self::FIELD_VERSION);
181 if (is_null($data)) {
182 return null;
183 }
184 $this->version = (int) $data;
185 }
186
187 return $this->version;
188 }
189
196 public function getCreatedAt()
197 {
198 if (is_null($this->createdAt)) {
200 $data = $this->raw(self::FIELD_CREATED_AT);
201 if (is_null($data)) {
202 return null;
203 }
204 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
205 if (false === $data) {
206 return null;
207 }
208 $this->createdAt = $data;
209 }
210
211 return $this->createdAt;
212 }
213
220 public function getLastModifiedAt()
221 {
222 if (is_null($this->lastModifiedAt)) {
224 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
225 if (is_null($data)) {
226 return null;
227 }
228 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
229 if (false === $data) {
230 return null;
231 }
232 $this->lastModifiedAt = $data;
233 }
234
236 }
237
244 public function getLastModifiedBy()
245 {
246 if (is_null($this->lastModifiedBy)) {
248 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
249 if (is_null($data)) {
250 return null;
251 }
252
253 $this->lastModifiedBy = LastModifiedByModel::of($data);
254 }
255
257 }
258
265 public function getCreatedBy()
266 {
267 if (is_null($this->createdBy)) {
269 $data = $this->raw(self::FIELD_CREATED_BY);
270 if (is_null($data)) {
271 return null;
272 }
273
274 $this->createdBy = CreatedByModel::of($data);
275 }
276
277 return $this->createdBy;
278 }
279
287 public function getSequenceNumber()
288 {
289 if (is_null($this->sequenceNumber)) {
291 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
292 if (is_null($data)) {
293 return null;
294 }
295 $this->sequenceNumber = (int) $data;
296 }
297
299 }
300
307 public function getResource()
308 {
309 if (is_null($this->resource)) {
311 $data = $this->raw(self::FIELD_RESOURCE);
312 if (is_null($data)) {
313 return null;
314 }
315 $className = ReferenceModel::resolveDiscriminatorClass($data);
316 $this->resource = $className::of($data);
317 }
318
319 return $this->resource;
320 }
321
328 public function getResourceVersion()
329 {
330 if (is_null($this->resourceVersion)) {
332 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
333 if (is_null($data)) {
334 return null;
335 }
336 $this->resourceVersion = (int) $data;
337 }
338
340 }
341
348 public function getType()
349 {
350 if (is_null($this->type)) {
352 $data = $this->raw(self::FIELD_TYPE);
353 if (is_null($data)) {
354 return null;
355 }
356 $this->type = (string) $data;
357 }
358
359 return $this->type;
360 }
361
369 {
370 if (is_null($this->resourceUserProvidedIdentifiers)) {
372 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
373 if (is_null($data)) {
374 return null;
375 }
376
377 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
378 }
379
381 }
382
389 public function getName()
390 {
391 if (is_null($this->name)) {
393 $data = $this->raw(self::FIELD_NAME);
394 if (is_null($data)) {
395 return null;
396 }
397 $this->name = (string) $data;
398 }
399
400 return $this->name;
401 }
402
409 public function getValue()
410 {
411 if (is_null($this->value)) {
413 $data = $this->raw(self::FIELD_VALUE);
414 if (is_null($data)) {
415 return null;
416 }
417 $this->value = $data;
418 }
419
420 return $this->value;
421 }
422
429 public function getDeliveryId()
430 {
431 if (is_null($this->deliveryId)) {
433 $data = $this->raw(self::FIELD_DELIVERY_ID);
434 if (is_null($data)) {
435 return null;
436 }
437 $this->deliveryId = (string) $data;
438 }
439
440 return $this->deliveryId;
441 }
442
443
447 public function setId(?string $id): void
448 {
449 $this->id = $id;
450 }
451
455 public function setVersion(?int $version): void
456 {
457 $this->version = $version;
458 }
459
463 public function setCreatedAt(?DateTimeImmutable $createdAt): void
464 {
465 $this->createdAt = $createdAt;
466 }
467
471 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
472 {
473 $this->lastModifiedAt = $lastModifiedAt;
474 }
475
480 {
481 $this->lastModifiedBy = $lastModifiedBy;
482 }
483
487 public function setCreatedBy(?CreatedBy $createdBy): void
488 {
489 $this->createdBy = $createdBy;
490 }
491
495 public function setSequenceNumber(?int $sequenceNumber): void
496 {
497 $this->sequenceNumber = $sequenceNumber;
498 }
499
503 public function setResource(?Reference $resource): void
504 {
505 $this->resource = $resource;
506 }
507
511 public function setResourceVersion(?int $resourceVersion): void
512 {
513 $this->resourceVersion = $resourceVersion;
514 }
515
520 {
521 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
522 }
523
527 public function setName(?string $name): void
528 {
529 $this->name = $name;
530 }
531
535 public function setValue($value): void
536 {
537 $this->value = $value;
538 }
539
543 public function setDeliveryId(?string $deliveryId): void
544 {
545 $this->deliveryId = $deliveryId;
546 }
547
548
549 #[\ReturnTypeWillChange]
550 public function jsonSerialize()
551 {
552 $data = $this->toArray();
553 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
554 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
555 }
556
557 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
558 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
559 }
560 return (object) $data;
561 }
562}
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?int $sequenceNumber=null, ?Reference $resource=null, ?int $resourceVersion=null, ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers=null, ?string $name=null, $value=null, ?string $deliveryId=null, ?string $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)