commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ParcelItemsUpdatedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
29{
30 public const DISCRIMINATOR_VALUE = 'ParcelItemsUpdated';
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 $parcelId;
102
107 protected $deliveryId;
108
113 protected $items;
114
119 protected $oldItems;
120
125 protected $shippingKey;
126
127
131 public function __construct(
132 ?string $id = null,
133 ?int $version = null,
134 ?DateTimeImmutable $createdAt = null,
135 ?DateTimeImmutable $lastModifiedAt = null,
137 ?CreatedBy $createdBy = null,
138 ?int $sequenceNumber = null,
139 ?Reference $resource = null,
140 ?int $resourceVersion = null,
142 ?string $parcelId = null,
143 ?string $deliveryId = null,
146 ?string $shippingKey = null,
147 ?string $type = null
148 ) {
149 $this->id = $id;
150 $this->version = $version;
151 $this->createdAt = $createdAt;
152 $this->lastModifiedAt = $lastModifiedAt;
153 $this->lastModifiedBy = $lastModifiedBy;
154 $this->createdBy = $createdBy;
155 $this->sequenceNumber = $sequenceNumber;
156 $this->resource = $resource;
157 $this->resourceVersion = $resourceVersion;
158 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
159 $this->parcelId = $parcelId;
160 $this->deliveryId = $deliveryId;
161 $this->items = $items;
162 $this->oldItems = $oldItems;
163 $this->shippingKey = $shippingKey;
164 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
165 }
166
173 public function getId()
174 {
175 if (is_null($this->id)) {
177 $data = $this->raw(self::FIELD_ID);
178 if (is_null($data)) {
179 return null;
180 }
181 $this->id = (string) $data;
182 }
183
184 return $this->id;
185 }
186
193 public function getVersion()
194 {
195 if (is_null($this->version)) {
197 $data = $this->raw(self::FIELD_VERSION);
198 if (is_null($data)) {
199 return null;
200 }
201 $this->version = (int) $data;
202 }
203
204 return $this->version;
205 }
206
213 public function getCreatedAt()
214 {
215 if (is_null($this->createdAt)) {
217 $data = $this->raw(self::FIELD_CREATED_AT);
218 if (is_null($data)) {
219 return null;
220 }
221 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
222 if (false === $data) {
223 return null;
224 }
225 $this->createdAt = $data;
226 }
227
228 return $this->createdAt;
229 }
230
237 public function getLastModifiedAt()
238 {
239 if (is_null($this->lastModifiedAt)) {
241 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
242 if (is_null($data)) {
243 return null;
244 }
245 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
246 if (false === $data) {
247 return null;
248 }
249 $this->lastModifiedAt = $data;
250 }
251
253 }
254
261 public function getLastModifiedBy()
262 {
263 if (is_null($this->lastModifiedBy)) {
265 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
266 if (is_null($data)) {
267 return null;
268 }
269
270 $this->lastModifiedBy = LastModifiedByModel::of($data);
271 }
272
274 }
275
282 public function getCreatedBy()
283 {
284 if (is_null($this->createdBy)) {
286 $data = $this->raw(self::FIELD_CREATED_BY);
287 if (is_null($data)) {
288 return null;
289 }
290
291 $this->createdBy = CreatedByModel::of($data);
292 }
293
294 return $this->createdBy;
295 }
296
304 public function getSequenceNumber()
305 {
306 if (is_null($this->sequenceNumber)) {
308 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
309 if (is_null($data)) {
310 return null;
311 }
312 $this->sequenceNumber = (int) $data;
313 }
314
316 }
317
324 public function getResource()
325 {
326 if (is_null($this->resource)) {
328 $data = $this->raw(self::FIELD_RESOURCE);
329 if (is_null($data)) {
330 return null;
331 }
332 $className = ReferenceModel::resolveDiscriminatorClass($data);
333 $this->resource = $className::of($data);
334 }
335
336 return $this->resource;
337 }
338
345 public function getResourceVersion()
346 {
347 if (is_null($this->resourceVersion)) {
349 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
350 if (is_null($data)) {
351 return null;
352 }
353 $this->resourceVersion = (int) $data;
354 }
355
357 }
358
365 public function getType()
366 {
367 if (is_null($this->type)) {
369 $data = $this->raw(self::FIELD_TYPE);
370 if (is_null($data)) {
371 return null;
372 }
373 $this->type = (string) $data;
374 }
375
376 return $this->type;
377 }
378
386 {
387 if (is_null($this->resourceUserProvidedIdentifiers)) {
389 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
390 if (is_null($data)) {
391 return null;
392 }
393
394 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
395 }
396
398 }
399
406 public function getParcelId()
407 {
408 if (is_null($this->parcelId)) {
410 $data = $this->raw(self::FIELD_PARCEL_ID);
411 if (is_null($data)) {
412 return null;
413 }
414 $this->parcelId = (string) $data;
415 }
416
417 return $this->parcelId;
418 }
419
426 public function getDeliveryId()
427 {
428 if (is_null($this->deliveryId)) {
430 $data = $this->raw(self::FIELD_DELIVERY_ID);
431 if (is_null($data)) {
432 return null;
433 }
434 $this->deliveryId = (string) $data;
435 }
436
437 return $this->deliveryId;
438 }
439
446 public function getItems()
447 {
448 if (is_null($this->items)) {
450 $data = $this->raw(self::FIELD_ITEMS);
451 if (is_null($data)) {
452 return null;
453 }
454 $this->items = DeliveryItemCollection::fromArray($data);
455 }
456
457 return $this->items;
458 }
459
466 public function getOldItems()
467 {
468 if (is_null($this->oldItems)) {
470 $data = $this->raw(self::FIELD_OLD_ITEMS);
471 if (is_null($data)) {
472 return null;
473 }
474 $this->oldItems = DeliveryItemCollection::fromArray($data);
475 }
476
477 return $this->oldItems;
478 }
479
486 public function getShippingKey()
487 {
488 if (is_null($this->shippingKey)) {
490 $data = $this->raw(self::FIELD_SHIPPING_KEY);
491 if (is_null($data)) {
492 return null;
493 }
494 $this->shippingKey = (string) $data;
495 }
496
497 return $this->shippingKey;
498 }
499
500
504 public function setId(?string $id): void
505 {
506 $this->id = $id;
507 }
508
512 public function setVersion(?int $version): void
513 {
514 $this->version = $version;
515 }
516
520 public function setCreatedAt(?DateTimeImmutable $createdAt): void
521 {
522 $this->createdAt = $createdAt;
523 }
524
528 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
529 {
530 $this->lastModifiedAt = $lastModifiedAt;
531 }
532
537 {
538 $this->lastModifiedBy = $lastModifiedBy;
539 }
540
544 public function setCreatedBy(?CreatedBy $createdBy): void
545 {
546 $this->createdBy = $createdBy;
547 }
548
552 public function setSequenceNumber(?int $sequenceNumber): void
553 {
554 $this->sequenceNumber = $sequenceNumber;
555 }
556
560 public function setResource(?Reference $resource): void
561 {
562 $this->resource = $resource;
563 }
564
568 public function setResourceVersion(?int $resourceVersion): void
569 {
570 $this->resourceVersion = $resourceVersion;
571 }
572
577 {
578 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
579 }
580
584 public function setParcelId(?string $parcelId): void
585 {
586 $this->parcelId = $parcelId;
587 }
588
592 public function setDeliveryId(?string $deliveryId): void
593 {
594 $this->deliveryId = $deliveryId;
595 }
596
600 public function setItems(?DeliveryItemCollection $items): void
601 {
602 $this->items = $items;
603 }
604
609 {
610 $this->oldItems = $oldItems;
611 }
612
616 public function setShippingKey(?string $shippingKey): void
617 {
618 $this->shippingKey = $shippingKey;
619 }
620
621
622 #[\ReturnTypeWillChange]
623 public function jsonSerialize()
624 {
625 $data = $this->toArray();
626 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
627 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
628 }
629
630 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
631 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
632 }
633 return (object) $data;
634 }
635}
__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 $parcelId=null, ?string $deliveryId=null, ?DeliveryItemCollection $items=null, ?DeliveryItemCollection $oldItems=null, ?string $shippingKey=null, ?string $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)