commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryItemsUpdatedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
29{
30 public const DISCRIMINATOR_VALUE = 'DeliveryItemsUpdated';
35 protected $id;
36
41 protected $version;
42
47 protected $createdAt;
48
53 protected $lastModifiedAt;
54
59 protected $lastModifiedBy;
60
65 protected $createdBy;
66
71 protected $sequenceNumber;
72
77 protected $resource;
78
84
89 protected $type;
90
96
101 protected $deliveryId;
102
107 protected $items;
108
113 protected $oldItems;
114
119 protected $shippingKey;
120
121
125 public function __construct(
126 ?string $id = null,
127 ?int $version = null,
128 ?DateTimeImmutable $createdAt = null,
129 ?DateTimeImmutable $lastModifiedAt = null,
131 ?CreatedBy $createdBy = null,
132 ?int $sequenceNumber = null,
133 ?Reference $resource = null,
134 ?int $resourceVersion = null,
136 ?string $deliveryId = null,
139 ?string $shippingKey = null,
140 ?string $type = null
141 ) {
142 $this->id = $id;
143 $this->version = $version;
144 $this->createdAt = $createdAt;
145 $this->lastModifiedAt = $lastModifiedAt;
146 $this->lastModifiedBy = $lastModifiedBy;
147 $this->createdBy = $createdBy;
148 $this->sequenceNumber = $sequenceNumber;
149 $this->resource = $resource;
150 $this->resourceVersion = $resourceVersion;
151 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
152 $this->deliveryId = $deliveryId;
153 $this->items = $items;
154 $this->oldItems = $oldItems;
155 $this->shippingKey = $shippingKey;
156 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
157 }
158
165 public function getId()
166 {
167 if (is_null($this->id)) {
169 $data = $this->raw(self::FIELD_ID);
170 if (is_null($data)) {
171 return null;
172 }
173 $this->id = (string) $data;
174 }
175
176 return $this->id;
177 }
178
185 public function getVersion()
186 {
187 if (is_null($this->version)) {
189 $data = $this->raw(self::FIELD_VERSION);
190 if (is_null($data)) {
191 return null;
192 }
193 $this->version = (int) $data;
194 }
195
196 return $this->version;
197 }
198
205 public function getCreatedAt()
206 {
207 if (is_null($this->createdAt)) {
209 $data = $this->raw(self::FIELD_CREATED_AT);
210 if (is_null($data)) {
211 return null;
212 }
213 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
214 if (false === $data) {
215 return null;
216 }
217 $this->createdAt = $data;
218 }
219
220 return $this->createdAt;
221 }
222
229 public function getLastModifiedAt()
230 {
231 if (is_null($this->lastModifiedAt)) {
233 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
234 if (is_null($data)) {
235 return null;
236 }
237 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
238 if (false === $data) {
239 return null;
240 }
241 $this->lastModifiedAt = $data;
242 }
243
245 }
246
253 public function getLastModifiedBy()
254 {
255 if (is_null($this->lastModifiedBy)) {
257 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
258 if (is_null($data)) {
259 return null;
260 }
261
262 $this->lastModifiedBy = LastModifiedByModel::of($data);
263 }
264
266 }
267
274 public function getCreatedBy()
275 {
276 if (is_null($this->createdBy)) {
278 $data = $this->raw(self::FIELD_CREATED_BY);
279 if (is_null($data)) {
280 return null;
281 }
282
283 $this->createdBy = CreatedByModel::of($data);
284 }
285
286 return $this->createdBy;
287 }
288
296 public function getSequenceNumber()
297 {
298 if (is_null($this->sequenceNumber)) {
300 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
301 if (is_null($data)) {
302 return null;
303 }
304 $this->sequenceNumber = (int) $data;
305 }
306
308 }
309
316 public function getResource()
317 {
318 if (is_null($this->resource)) {
320 $data = $this->raw(self::FIELD_RESOURCE);
321 if (is_null($data)) {
322 return null;
323 }
324 $className = ReferenceModel::resolveDiscriminatorClass($data);
325 $this->resource = $className::of($data);
326 }
327
328 return $this->resource;
329 }
330
337 public function getResourceVersion()
338 {
339 if (is_null($this->resourceVersion)) {
341 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
342 if (is_null($data)) {
343 return null;
344 }
345 $this->resourceVersion = (int) $data;
346 }
347
349 }
350
357 public function getType()
358 {
359 if (is_null($this->type)) {
361 $data = $this->raw(self::FIELD_TYPE);
362 if (is_null($data)) {
363 return null;
364 }
365 $this->type = (string) $data;
366 }
367
368 return $this->type;
369 }
370
378 {
379 if (is_null($this->resourceUserProvidedIdentifiers)) {
381 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
382 if (is_null($data)) {
383 return null;
384 }
385
386 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
387 }
388
390 }
391
398 public function getDeliveryId()
399 {
400 if (is_null($this->deliveryId)) {
402 $data = $this->raw(self::FIELD_DELIVERY_ID);
403 if (is_null($data)) {
404 return null;
405 }
406 $this->deliveryId = (string) $data;
407 }
408
409 return $this->deliveryId;
410 }
411
418 public function getItems()
419 {
420 if (is_null($this->items)) {
422 $data = $this->raw(self::FIELD_ITEMS);
423 if (is_null($data)) {
424 return null;
425 }
426 $this->items = DeliveryItemCollection::fromArray($data);
427 }
428
429 return $this->items;
430 }
431
438 public function getOldItems()
439 {
440 if (is_null($this->oldItems)) {
442 $data = $this->raw(self::FIELD_OLD_ITEMS);
443 if (is_null($data)) {
444 return null;
445 }
446 $this->oldItems = DeliveryItemCollection::fromArray($data);
447 }
448
449 return $this->oldItems;
450 }
451
458 public function getShippingKey()
459 {
460 if (is_null($this->shippingKey)) {
462 $data = $this->raw(self::FIELD_SHIPPING_KEY);
463 if (is_null($data)) {
464 return null;
465 }
466 $this->shippingKey = (string) $data;
467 }
468
469 return $this->shippingKey;
470 }
471
472
476 public function setId(?string $id): void
477 {
478 $this->id = $id;
479 }
480
484 public function setVersion(?int $version): void
485 {
486 $this->version = $version;
487 }
488
492 public function setCreatedAt(?DateTimeImmutable $createdAt): void
493 {
494 $this->createdAt = $createdAt;
495 }
496
500 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
501 {
502 $this->lastModifiedAt = $lastModifiedAt;
503 }
504
509 {
510 $this->lastModifiedBy = $lastModifiedBy;
511 }
512
516 public function setCreatedBy(?CreatedBy $createdBy): void
517 {
518 $this->createdBy = $createdBy;
519 }
520
524 public function setSequenceNumber(?int $sequenceNumber): void
525 {
526 $this->sequenceNumber = $sequenceNumber;
527 }
528
532 public function setResource(?Reference $resource): void
533 {
534 $this->resource = $resource;
535 }
536
540 public function setResourceVersion(?int $resourceVersion): void
541 {
542 $this->resourceVersion = $resourceVersion;
543 }
544
549 {
550 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
551 }
552
556 public function setDeliveryId(?string $deliveryId): void
557 {
558 $this->deliveryId = $deliveryId;
559 }
560
564 public function setItems(?DeliveryItemCollection $items): void
565 {
566 $this->items = $items;
567 }
568
573 {
574 $this->oldItems = $oldItems;
575 }
576
580 public function setShippingKey(?string $shippingKey): void
581 {
582 $this->shippingKey = $shippingKey;
583 }
584
585
586 #[\ReturnTypeWillChange]
587 public function jsonSerialize()
588 {
589 $data = $this->toArray();
590 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
591 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
592 }
593
594 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
595 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
596 }
597 return (object) $data;
598 }
599}
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
__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 $deliveryId=null, ?DeliveryItemCollection $items=null, ?DeliveryItemCollection $oldItems=null, ?string $shippingKey=null, ?string $type=null)