commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryCustomFieldChangedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
21use DateTimeImmutable;
22use stdClass;
23
28{
29 public const DISCRIMINATOR_VALUE = 'DeliveryCustomFieldChanged';
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 $previousValue;
113
118 protected $deliveryId;
119
120
124 public function __construct(
125 ?string $id = null,
126 ?int $version = null,
127 ?DateTimeImmutable $createdAt = null,
128 ?DateTimeImmutable $lastModifiedAt = null,
130 ?CreatedBy $createdBy = null,
131 ?int $sequenceNumber = null,
132 ?Reference $resource = null,
133 ?int $resourceVersion = null,
135 ?string $name = null,
136 $value = null,
137 $previousValue = null,
138 ?string $deliveryId = null,
139 ?string $type = null
140 ) {
141 $this->id = $id;
142 $this->version = $version;
143 $this->createdAt = $createdAt;
144 $this->lastModifiedAt = $lastModifiedAt;
145 $this->lastModifiedBy = $lastModifiedBy;
146 $this->createdBy = $createdBy;
147 $this->sequenceNumber = $sequenceNumber;
148 $this->resource = $resource;
149 $this->resourceVersion = $resourceVersion;
150 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
151 $this->name = $name;
152 $this->value = $value;
153 $this->previousValue = $previousValue;
154 $this->deliveryId = $deliveryId;
155 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
156 }
157
164 public function getId()
165 {
166 if (is_null($this->id)) {
168 $data = $this->raw(self::FIELD_ID);
169 if (is_null($data)) {
170 return null;
171 }
172 $this->id = (string) $data;
173 }
174
175 return $this->id;
176 }
177
184 public function getVersion()
185 {
186 if (is_null($this->version)) {
188 $data = $this->raw(self::FIELD_VERSION);
189 if (is_null($data)) {
190 return null;
191 }
192 $this->version = (int) $data;
193 }
194
195 return $this->version;
196 }
197
204 public function getCreatedAt()
205 {
206 if (is_null($this->createdAt)) {
208 $data = $this->raw(self::FIELD_CREATED_AT);
209 if (is_null($data)) {
210 return null;
211 }
212 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
213 if (false === $data) {
214 return null;
215 }
216 $this->createdAt = $data;
217 }
218
219 return $this->createdAt;
220 }
221
228 public function getLastModifiedAt()
229 {
230 if (is_null($this->lastModifiedAt)) {
232 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
233 if (is_null($data)) {
234 return null;
235 }
236 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
237 if (false === $data) {
238 return null;
239 }
240 $this->lastModifiedAt = $data;
241 }
242
244 }
245
252 public function getLastModifiedBy()
253 {
254 if (is_null($this->lastModifiedBy)) {
256 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
257 if (is_null($data)) {
258 return null;
259 }
260
261 $this->lastModifiedBy = LastModifiedByModel::of($data);
262 }
263
265 }
266
273 public function getCreatedBy()
274 {
275 if (is_null($this->createdBy)) {
277 $data = $this->raw(self::FIELD_CREATED_BY);
278 if (is_null($data)) {
279 return null;
280 }
281
282 $this->createdBy = CreatedByModel::of($data);
283 }
284
285 return $this->createdBy;
286 }
287
295 public function getSequenceNumber()
296 {
297 if (is_null($this->sequenceNumber)) {
299 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
300 if (is_null($data)) {
301 return null;
302 }
303 $this->sequenceNumber = (int) $data;
304 }
305
307 }
308
315 public function getResource()
316 {
317 if (is_null($this->resource)) {
319 $data = $this->raw(self::FIELD_RESOURCE);
320 if (is_null($data)) {
321 return null;
322 }
323 $className = ReferenceModel::resolveDiscriminatorClass($data);
324 $this->resource = $className::of($data);
325 }
326
327 return $this->resource;
328 }
329
336 public function getResourceVersion()
337 {
338 if (is_null($this->resourceVersion)) {
340 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
341 if (is_null($data)) {
342 return null;
343 }
344 $this->resourceVersion = (int) $data;
345 }
346
348 }
349
356 public function getType()
357 {
358 if (is_null($this->type)) {
360 $data = $this->raw(self::FIELD_TYPE);
361 if (is_null($data)) {
362 return null;
363 }
364 $this->type = (string) $data;
365 }
366
367 return $this->type;
368 }
369
377 {
378 if (is_null($this->resourceUserProvidedIdentifiers)) {
380 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
381 if (is_null($data)) {
382 return null;
383 }
384
385 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
386 }
387
389 }
390
397 public function getName()
398 {
399 if (is_null($this->name)) {
401 $data = $this->raw(self::FIELD_NAME);
402 if (is_null($data)) {
403 return null;
404 }
405 $this->name = (string) $data;
406 }
407
408 return $this->name;
409 }
410
417 public function getValue()
418 {
419 if (is_null($this->value)) {
421 $data = $this->raw(self::FIELD_VALUE);
422 if (is_null($data)) {
423 return null;
424 }
425 $this->value = $data;
426 }
427
428 return $this->value;
429 }
430
438 public function getPreviousValue()
439 {
440 if (is_null($this->previousValue)) {
442 $data = $this->raw(self::FIELD_PREVIOUS_VALUE);
443 if (is_null($data)) {
444 return null;
445 }
446 $this->previousValue = $data;
447 }
448
450 }
451
458 public function getDeliveryId()
459 {
460 if (is_null($this->deliveryId)) {
462 $data = $this->raw(self::FIELD_DELIVERY_ID);
463 if (is_null($data)) {
464 return null;
465 }
466 $this->deliveryId = (string) $data;
467 }
468
469 return $this->deliveryId;
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 setName(?string $name): void
557 {
558 $this->name = $name;
559 }
560
564 public function setValue($value): void
565 {
566 $this->value = $value;
567 }
568
572 public function setPreviousValue($previousValue): void
573 {
574 $this->previousValue = $previousValue;
575 }
576
580 public function setDeliveryId(?string $deliveryId): void
581 {
582 $this->deliveryId = $deliveryId;
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 $name=null, $value=null, $previousValue=null, ?string $deliveryId=null, ?string $type=null)