commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ApprovalFlowRejectedMessageModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
25 use DateTimeImmutable;
26 use stdClass;
27 
32 {
33  public const DISCRIMINATOR_VALUE = 'ApprovalFlowRejected';
38  protected $id;
39 
44  protected $version;
45 
50  protected $createdAt;
51 
56  protected $lastModifiedAt;
57 
62  protected $lastModifiedBy;
63 
68  protected $createdBy;
69 
74  protected $sequenceNumber;
75 
80  protected $resource;
81 
86  protected $resourceVersion;
87 
92  protected $type;
93 
99 
104  protected $associate;
105 
110  protected $rejectionReason;
111 
116  protected $order;
117 
118 
122  public function __construct(
123  ?string $id = null,
124  ?int $version = null,
125  ?DateTimeImmutable $createdAt = null,
126  ?DateTimeImmutable $lastModifiedAt = null,
128  ?CreatedBy $createdBy = null,
129  ?int $sequenceNumber = null,
130  ?Reference $resource = null,
131  ?int $resourceVersion = null,
134  ?string $rejectionReason = null,
135  ?OrderReference $order = null,
136  ?string $type = null
137  ) {
138  $this->id = $id;
139  $this->version = $version;
140  $this->createdAt = $createdAt;
141  $this->lastModifiedAt = $lastModifiedAt;
142  $this->lastModifiedBy = $lastModifiedBy;
143  $this->createdBy = $createdBy;
144  $this->sequenceNumber = $sequenceNumber;
145  $this->resource = $resource;
146  $this->resourceVersion = $resourceVersion;
147  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
148  $this->associate = $associate;
149  $this->rejectionReason = $rejectionReason;
150  $this->order = $order;
151  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
152  }
153 
160  public function getId()
161  {
162  if (is_null($this->id)) {
164  $data = $this->raw(self::FIELD_ID);
165  if (is_null($data)) {
166  return null;
167  }
168  $this->id = (string) $data;
169  }
170 
171  return $this->id;
172  }
173 
180  public function getVersion()
181  {
182  if (is_null($this->version)) {
184  $data = $this->raw(self::FIELD_VERSION);
185  if (is_null($data)) {
186  return null;
187  }
188  $this->version = (int) $data;
189  }
190 
191  return $this->version;
192  }
193 
200  public function getCreatedAt()
201  {
202  if (is_null($this->createdAt)) {
204  $data = $this->raw(self::FIELD_CREATED_AT);
205  if (is_null($data)) {
206  return null;
207  }
208  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
209  if (false === $data) {
210  return null;
211  }
212  $this->createdAt = $data;
213  }
214 
215  return $this->createdAt;
216  }
217 
224  public function getLastModifiedAt()
225  {
226  if (is_null($this->lastModifiedAt)) {
228  $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
229  if (is_null($data)) {
230  return null;
231  }
232  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
233  if (false === $data) {
234  return null;
235  }
236  $this->lastModifiedAt = $data;
237  }
238 
239  return $this->lastModifiedAt;
240  }
241 
248  public function getLastModifiedBy()
249  {
250  if (is_null($this->lastModifiedBy)) {
252  $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
253  if (is_null($data)) {
254  return null;
255  }
256 
257  $this->lastModifiedBy = LastModifiedByModel::of($data);
258  }
259 
260  return $this->lastModifiedBy;
261  }
262 
269  public function getCreatedBy()
270  {
271  if (is_null($this->createdBy)) {
273  $data = $this->raw(self::FIELD_CREATED_BY);
274  if (is_null($data)) {
275  return null;
276  }
277 
278  $this->createdBy = CreatedByModel::of($data);
279  }
280 
281  return $this->createdBy;
282  }
283 
291  public function getSequenceNumber()
292  {
293  if (is_null($this->sequenceNumber)) {
295  $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
296  if (is_null($data)) {
297  return null;
298  }
299  $this->sequenceNumber = (int) $data;
300  }
301 
302  return $this->sequenceNumber;
303  }
304 
311  public function getResource()
312  {
313  if (is_null($this->resource)) {
315  $data = $this->raw(self::FIELD_RESOURCE);
316  if (is_null($data)) {
317  return null;
318  }
319  $className = ReferenceModel::resolveDiscriminatorClass($data);
320  $this->resource = $className::of($data);
321  }
322 
323  return $this->resource;
324  }
325 
332  public function getResourceVersion()
333  {
334  if (is_null($this->resourceVersion)) {
336  $data = $this->raw(self::FIELD_RESOURCE_VERSION);
337  if (is_null($data)) {
338  return null;
339  }
340  $this->resourceVersion = (int) $data;
341  }
342 
343  return $this->resourceVersion;
344  }
345 
352  public function getType()
353  {
354  if (is_null($this->type)) {
356  $data = $this->raw(self::FIELD_TYPE);
357  if (is_null($data)) {
358  return null;
359  }
360  $this->type = (string) $data;
361  }
362 
363  return $this->type;
364  }
365 
373  {
374  if (is_null($this->resourceUserProvidedIdentifiers)) {
376  $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
377  if (is_null($data)) {
378  return null;
379  }
380 
381  $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
382  }
383 
385  }
386 
393  public function getAssociate()
394  {
395  if (is_null($this->associate)) {
397  $data = $this->raw(self::FIELD_ASSOCIATE);
398  if (is_null($data)) {
399  return null;
400  }
401 
402  $this->associate = CustomerReferenceModel::of($data);
403  }
404 
405  return $this->associate;
406  }
407 
414  public function getRejectionReason()
415  {
416  if (is_null($this->rejectionReason)) {
418  $data = $this->raw(self::FIELD_REJECTION_REASON);
419  if (is_null($data)) {
420  return null;
421  }
422  $this->rejectionReason = (string) $data;
423  }
424 
425  return $this->rejectionReason;
426  }
427 
434  public function getOrder()
435  {
436  if (is_null($this->order)) {
438  $data = $this->raw(self::FIELD_ORDER);
439  if (is_null($data)) {
440  return null;
441  }
442 
443  $this->order = OrderReferenceModel::of($data);
444  }
445 
446  return $this->order;
447  }
448 
449 
453  public function setId(?string $id): void
454  {
455  $this->id = $id;
456  }
457 
461  public function setVersion(?int $version): void
462  {
463  $this->version = $version;
464  }
465 
469  public function setCreatedAt(?DateTimeImmutable $createdAt): void
470  {
471  $this->createdAt = $createdAt;
472  }
473 
477  public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
478  {
479  $this->lastModifiedAt = $lastModifiedAt;
480  }
481 
486  {
487  $this->lastModifiedBy = $lastModifiedBy;
488  }
489 
493  public function setCreatedBy(?CreatedBy $createdBy): void
494  {
495  $this->createdBy = $createdBy;
496  }
497 
501  public function setSequenceNumber(?int $sequenceNumber): void
502  {
503  $this->sequenceNumber = $sequenceNumber;
504  }
505 
509  public function setResource(?Reference $resource): void
510  {
511  $this->resource = $resource;
512  }
513 
517  public function setResourceVersion(?int $resourceVersion): void
518  {
519  $this->resourceVersion = $resourceVersion;
520  }
521 
526  {
527  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
528  }
529 
533  public function setAssociate(?CustomerReference $associate): void
534  {
535  $this->associate = $associate;
536  }
537 
541  public function setRejectionReason(?string $rejectionReason): void
542  {
543  $this->rejectionReason = $rejectionReason;
544  }
545 
549  public function setOrder(?OrderReference $order): void
550  {
551  $this->order = $order;
552  }
553 
554 
555  #[\ReturnTypeWillChange]
556  public function jsonSerialize()
557  {
558  $data = $this->toArray();
559  if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
560  $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
561  }
562 
563  if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
564  $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
565  }
566  return (object) $data;
567  }
568 }
__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, ?CustomerReference $associate=null, ?string $rejectionReason=null, ?OrderReference $order=null, ?string $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)