commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ApprovalFlowCompletedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
30{
31 public const DISCRIMINATOR_VALUE = 'ApprovalFlowCompleted';
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 $status;
103
108 protected $order;
109
110
114 public function __construct(
115 ?string $id = null,
116 ?int $version = null,
117 ?DateTimeImmutable $createdAt = null,
118 ?DateTimeImmutable $lastModifiedAt = null,
120 ?CreatedBy $createdBy = null,
121 ?int $sequenceNumber = null,
122 ?Reference $resource = null,
123 ?int $resourceVersion = null,
125 ?string $status = null,
126 ?OrderReference $order = null,
127 ?string $type = null
128 ) {
129 $this->id = $id;
130 $this->version = $version;
131 $this->createdAt = $createdAt;
132 $this->lastModifiedAt = $lastModifiedAt;
133 $this->lastModifiedBy = $lastModifiedBy;
134 $this->createdBy = $createdBy;
135 $this->sequenceNumber = $sequenceNumber;
136 $this->resource = $resource;
137 $this->resourceVersion = $resourceVersion;
138 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
139 $this->status = $status;
140 $this->order = $order;
141 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
142 }
143
150 public function getId()
151 {
152 if (is_null($this->id)) {
154 $data = $this->raw(self::FIELD_ID);
155 if (is_null($data)) {
156 return null;
157 }
158 $this->id = (string) $data;
159 }
160
161 return $this->id;
162 }
163
170 public function getVersion()
171 {
172 if (is_null($this->version)) {
174 $data = $this->raw(self::FIELD_VERSION);
175 if (is_null($data)) {
176 return null;
177 }
178 $this->version = (int) $data;
179 }
180
181 return $this->version;
182 }
183
190 public function getCreatedAt()
191 {
192 if (is_null($this->createdAt)) {
194 $data = $this->raw(self::FIELD_CREATED_AT);
195 if (is_null($data)) {
196 return null;
197 }
198 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
199 if (false === $data) {
200 return null;
201 }
202 $this->createdAt = $data;
203 }
204
205 return $this->createdAt;
206 }
207
214 public function getLastModifiedAt()
215 {
216 if (is_null($this->lastModifiedAt)) {
218 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
219 if (is_null($data)) {
220 return null;
221 }
222 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
223 if (false === $data) {
224 return null;
225 }
226 $this->lastModifiedAt = $data;
227 }
228
230 }
231
238 public function getLastModifiedBy()
239 {
240 if (is_null($this->lastModifiedBy)) {
242 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
243 if (is_null($data)) {
244 return null;
245 }
246
247 $this->lastModifiedBy = LastModifiedByModel::of($data);
248 }
249
251 }
252
259 public function getCreatedBy()
260 {
261 if (is_null($this->createdBy)) {
263 $data = $this->raw(self::FIELD_CREATED_BY);
264 if (is_null($data)) {
265 return null;
266 }
267
268 $this->createdBy = CreatedByModel::of($data);
269 }
270
271 return $this->createdBy;
272 }
273
281 public function getSequenceNumber()
282 {
283 if (is_null($this->sequenceNumber)) {
285 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
286 if (is_null($data)) {
287 return null;
288 }
289 $this->sequenceNumber = (int) $data;
290 }
291
293 }
294
301 public function getResource()
302 {
303 if (is_null($this->resource)) {
305 $data = $this->raw(self::FIELD_RESOURCE);
306 if (is_null($data)) {
307 return null;
308 }
309 $className = ReferenceModel::resolveDiscriminatorClass($data);
310 $this->resource = $className::of($data);
311 }
312
313 return $this->resource;
314 }
315
322 public function getResourceVersion()
323 {
324 if (is_null($this->resourceVersion)) {
326 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
327 if (is_null($data)) {
328 return null;
329 }
330 $this->resourceVersion = (int) $data;
331 }
332
334 }
335
342 public function getType()
343 {
344 if (is_null($this->type)) {
346 $data = $this->raw(self::FIELD_TYPE);
347 if (is_null($data)) {
348 return null;
349 }
350 $this->type = (string) $data;
351 }
352
353 return $this->type;
354 }
355
363 {
364 if (is_null($this->resourceUserProvidedIdentifiers)) {
366 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
367 if (is_null($data)) {
368 return null;
369 }
370
371 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
372 }
373
375 }
376
383 public function getStatus()
384 {
385 if (is_null($this->status)) {
387 $data = $this->raw(self::FIELD_STATUS);
388 if (is_null($data)) {
389 return null;
390 }
391 $this->status = (string) $data;
392 }
393
394 return $this->status;
395 }
396
403 public function getOrder()
404 {
405 if (is_null($this->order)) {
407 $data = $this->raw(self::FIELD_ORDER);
408 if (is_null($data)) {
409 return null;
410 }
411
412 $this->order = OrderReferenceModel::of($data);
413 }
414
415 return $this->order;
416 }
417
418
422 public function setId(?string $id): void
423 {
424 $this->id = $id;
425 }
426
430 public function setVersion(?int $version): void
431 {
432 $this->version = $version;
433 }
434
438 public function setCreatedAt(?DateTimeImmutable $createdAt): void
439 {
440 $this->createdAt = $createdAt;
441 }
442
446 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
447 {
448 $this->lastModifiedAt = $lastModifiedAt;
449 }
450
455 {
456 $this->lastModifiedBy = $lastModifiedBy;
457 }
458
462 public function setCreatedBy(?CreatedBy $createdBy): void
463 {
464 $this->createdBy = $createdBy;
465 }
466
470 public function setSequenceNumber(?int $sequenceNumber): void
471 {
472 $this->sequenceNumber = $sequenceNumber;
473 }
474
478 public function setResource(?Reference $resource): void
479 {
480 $this->resource = $resource;
481 }
482
486 public function setResourceVersion(?int $resourceVersion): void
487 {
488 $this->resourceVersion = $resourceVersion;
489 }
490
495 {
496 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
497 }
498
502 public function setStatus(?string $status): void
503 {
504 $this->status = $status;
505 }
506
510 public function setOrder(?OrderReference $order): void
511 {
512 $this->order = $order;
513 }
514
515
516 #[\ReturnTypeWillChange]
517 public function jsonSerialize()
518 {
519 $data = $this->toArray();
520 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
521 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
522 }
523
524 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
525 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
526 }
527 return (object) $data;
528 }
529}
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 $status=null, ?OrderReference $order=null, ?string $type=null)