commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryAddressSetMessageModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
30{
31 public const DISCRIMINATOR_VALUE = 'DeliveryAddressSet';
36 protected $id;
37
42 protected $version;
43
48 protected $createdAt;
49
54 protected $lastModifiedAt;
55
60 protected $lastModifiedBy;
61
66 protected $createdBy;
67
72 protected $sequenceNumber;
73
78 protected $resource;
79
85
90 protected $type;
91
97
102 protected $deliveryId;
103
108 protected $address;
109
114 protected $oldAddress;
115
120 protected $shippingKey;
121
122
126 public function __construct(
127 ?string $id = null,
128 ?int $version = null,
129 ?DateTimeImmutable $createdAt = null,
130 ?DateTimeImmutable $lastModifiedAt = null,
132 ?CreatedBy $createdBy = null,
133 ?int $sequenceNumber = null,
134 ?Reference $resource = null,
135 ?int $resourceVersion = null,
137 ?string $deliveryId = null,
138 ?Address $address = null,
139 ?Address $oldAddress = null,
140 ?string $shippingKey = null,
141 ?string $type = null
142 ) {
143 $this->id = $id;
144 $this->version = $version;
145 $this->createdAt = $createdAt;
146 $this->lastModifiedAt = $lastModifiedAt;
147 $this->lastModifiedBy = $lastModifiedBy;
148 $this->createdBy = $createdBy;
149 $this->sequenceNumber = $sequenceNumber;
150 $this->resource = $resource;
151 $this->resourceVersion = $resourceVersion;
152 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
153 $this->deliveryId = $deliveryId;
154 $this->address = $address;
155 $this->oldAddress = $oldAddress;
156 $this->shippingKey = $shippingKey;
157 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
158 }
159
166 public function getId()
167 {
168 if (is_null($this->id)) {
170 $data = $this->raw(self::FIELD_ID);
171 if (is_null($data)) {
172 return null;
173 }
174 $this->id = (string) $data;
175 }
176
177 return $this->id;
178 }
179
186 public function getVersion()
187 {
188 if (is_null($this->version)) {
190 $data = $this->raw(self::FIELD_VERSION);
191 if (is_null($data)) {
192 return null;
193 }
194 $this->version = (int) $data;
195 }
196
197 return $this->version;
198 }
199
206 public function getCreatedAt()
207 {
208 if (is_null($this->createdAt)) {
210 $data = $this->raw(self::FIELD_CREATED_AT);
211 if (is_null($data)) {
212 return null;
213 }
214 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
215 if (false === $data) {
216 return null;
217 }
218 $this->createdAt = $data;
219 }
220
221 return $this->createdAt;
222 }
223
230 public function getLastModifiedAt()
231 {
232 if (is_null($this->lastModifiedAt)) {
234 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
235 if (is_null($data)) {
236 return null;
237 }
238 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
239 if (false === $data) {
240 return null;
241 }
242 $this->lastModifiedAt = $data;
243 }
244
246 }
247
254 public function getLastModifiedBy()
255 {
256 if (is_null($this->lastModifiedBy)) {
258 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
259 if (is_null($data)) {
260 return null;
261 }
262
263 $this->lastModifiedBy = LastModifiedByModel::of($data);
264 }
265
267 }
268
275 public function getCreatedBy()
276 {
277 if (is_null($this->createdBy)) {
279 $data = $this->raw(self::FIELD_CREATED_BY);
280 if (is_null($data)) {
281 return null;
282 }
283
284 $this->createdBy = CreatedByModel::of($data);
285 }
286
287 return $this->createdBy;
288 }
289
297 public function getSequenceNumber()
298 {
299 if (is_null($this->sequenceNumber)) {
301 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
302 if (is_null($data)) {
303 return null;
304 }
305 $this->sequenceNumber = (int) $data;
306 }
307
309 }
310
317 public function getResource()
318 {
319 if (is_null($this->resource)) {
321 $data = $this->raw(self::FIELD_RESOURCE);
322 if (is_null($data)) {
323 return null;
324 }
325 $className = ReferenceModel::resolveDiscriminatorClass($data);
326 $this->resource = $className::of($data);
327 }
328
329 return $this->resource;
330 }
331
338 public function getResourceVersion()
339 {
340 if (is_null($this->resourceVersion)) {
342 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
343 if (is_null($data)) {
344 return null;
345 }
346 $this->resourceVersion = (int) $data;
347 }
348
350 }
351
358 public function getType()
359 {
360 if (is_null($this->type)) {
362 $data = $this->raw(self::FIELD_TYPE);
363 if (is_null($data)) {
364 return null;
365 }
366 $this->type = (string) $data;
367 }
368
369 return $this->type;
370 }
371
379 {
380 if (is_null($this->resourceUserProvidedIdentifiers)) {
382 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
383 if (is_null($data)) {
384 return null;
385 }
386
387 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
388 }
389
391 }
392
399 public function getDeliveryId()
400 {
401 if (is_null($this->deliveryId)) {
403 $data = $this->raw(self::FIELD_DELIVERY_ID);
404 if (is_null($data)) {
405 return null;
406 }
407 $this->deliveryId = (string) $data;
408 }
409
410 return $this->deliveryId;
411 }
412
419 public function getAddress()
420 {
421 if (is_null($this->address)) {
423 $data = $this->raw(self::FIELD_ADDRESS);
424 if (is_null($data)) {
425 return null;
426 }
427
428 $this->address = AddressModel::of($data);
429 }
430
431 return $this->address;
432 }
433
440 public function getOldAddress()
441 {
442 if (is_null($this->oldAddress)) {
444 $data = $this->raw(self::FIELD_OLD_ADDRESS);
445 if (is_null($data)) {
446 return null;
447 }
448
449 $this->oldAddress = AddressModel::of($data);
450 }
451
452 return $this->oldAddress;
453 }
454
461 public function getShippingKey()
462 {
463 if (is_null($this->shippingKey)) {
465 $data = $this->raw(self::FIELD_SHIPPING_KEY);
466 if (is_null($data)) {
467 return null;
468 }
469 $this->shippingKey = (string) $data;
470 }
471
472 return $this->shippingKey;
473 }
474
475
479 public function setId(?string $id): void
480 {
481 $this->id = $id;
482 }
483
487 public function setVersion(?int $version): void
488 {
489 $this->version = $version;
490 }
491
495 public function setCreatedAt(?DateTimeImmutable $createdAt): void
496 {
497 $this->createdAt = $createdAt;
498 }
499
503 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
504 {
505 $this->lastModifiedAt = $lastModifiedAt;
506 }
507
512 {
513 $this->lastModifiedBy = $lastModifiedBy;
514 }
515
519 public function setCreatedBy(?CreatedBy $createdBy): void
520 {
521 $this->createdBy = $createdBy;
522 }
523
527 public function setSequenceNumber(?int $sequenceNumber): void
528 {
529 $this->sequenceNumber = $sequenceNumber;
530 }
531
535 public function setResource(?Reference $resource): void
536 {
537 $this->resource = $resource;
538 }
539
543 public function setResourceVersion(?int $resourceVersion): void
544 {
545 $this->resourceVersion = $resourceVersion;
546 }
547
552 {
553 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
554 }
555
559 public function setDeliveryId(?string $deliveryId): void
560 {
561 $this->deliveryId = $deliveryId;
562 }
563
567 public function setAddress(?Address $address): void
568 {
569 $this->address = $address;
570 }
571
575 public function setOldAddress(?Address $oldAddress): void
576 {
577 $this->oldAddress = $oldAddress;
578 }
579
583 public function setShippingKey(?string $shippingKey): void
584 {
585 $this->shippingKey = $shippingKey;
586 }
587
588
589 #[\ReturnTypeWillChange]
590 public function jsonSerialize()
591 {
592 $data = $this->toArray();
593 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
594 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
595 }
596
597 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
598 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
599 }
600 return (object) $data;
601 }
602}
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, ?Address $address=null, ?Address $oldAddress=null, ?string $shippingKey=null, ?string $type=null)