commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerDeletedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
21use DateTimeImmutable;
22use stdClass;
23
28{
29 public const DISCRIMINATOR_VALUE = 'CustomerDeleted';
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
96
100 public function __construct(
101 ?string $id = null,
102 ?int $version = null,
103 ?DateTimeImmutable $createdAt = null,
104 ?DateTimeImmutable $lastModifiedAt = null,
106 ?CreatedBy $createdBy = null,
107 ?int $sequenceNumber = null,
108 ?Reference $resource = null,
109 ?int $resourceVersion = null,
111 ?string $type = null
112 ) {
113 $this->id = $id;
114 $this->version = $version;
115 $this->createdAt = $createdAt;
116 $this->lastModifiedAt = $lastModifiedAt;
117 $this->lastModifiedBy = $lastModifiedBy;
118 $this->createdBy = $createdBy;
119 $this->sequenceNumber = $sequenceNumber;
120 $this->resource = $resource;
121 $this->resourceVersion = $resourceVersion;
122 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
123 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
124 }
125
132 public function getId()
133 {
134 if (is_null($this->id)) {
136 $data = $this->raw(self::FIELD_ID);
137 if (is_null($data)) {
138 return null;
139 }
140 $this->id = (string) $data;
141 }
142
143 return $this->id;
144 }
145
152 public function getVersion()
153 {
154 if (is_null($this->version)) {
156 $data = $this->raw(self::FIELD_VERSION);
157 if (is_null($data)) {
158 return null;
159 }
160 $this->version = (int) $data;
161 }
162
163 return $this->version;
164 }
165
172 public function getCreatedAt()
173 {
174 if (is_null($this->createdAt)) {
176 $data = $this->raw(self::FIELD_CREATED_AT);
177 if (is_null($data)) {
178 return null;
179 }
180 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
181 if (false === $data) {
182 return null;
183 }
184 $this->createdAt = $data;
185 }
186
187 return $this->createdAt;
188 }
189
196 public function getLastModifiedAt()
197 {
198 if (is_null($this->lastModifiedAt)) {
200 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
201 if (is_null($data)) {
202 return null;
203 }
204 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
205 if (false === $data) {
206 return null;
207 }
208 $this->lastModifiedAt = $data;
209 }
210
212 }
213
220 public function getLastModifiedBy()
221 {
222 if (is_null($this->lastModifiedBy)) {
224 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
225 if (is_null($data)) {
226 return null;
227 }
228
229 $this->lastModifiedBy = LastModifiedByModel::of($data);
230 }
231
233 }
234
241 public function getCreatedBy()
242 {
243 if (is_null($this->createdBy)) {
245 $data = $this->raw(self::FIELD_CREATED_BY);
246 if (is_null($data)) {
247 return null;
248 }
249
250 $this->createdBy = CreatedByModel::of($data);
251 }
252
253 return $this->createdBy;
254 }
255
263 public function getSequenceNumber()
264 {
265 if (is_null($this->sequenceNumber)) {
267 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
268 if (is_null($data)) {
269 return null;
270 }
271 $this->sequenceNumber = (int) $data;
272 }
273
275 }
276
283 public function getResource()
284 {
285 if (is_null($this->resource)) {
287 $data = $this->raw(self::FIELD_RESOURCE);
288 if (is_null($data)) {
289 return null;
290 }
291 $className = ReferenceModel::resolveDiscriminatorClass($data);
292 $this->resource = $className::of($data);
293 }
294
295 return $this->resource;
296 }
297
304 public function getResourceVersion()
305 {
306 if (is_null($this->resourceVersion)) {
308 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
309 if (is_null($data)) {
310 return null;
311 }
312 $this->resourceVersion = (int) $data;
313 }
314
316 }
317
324 public function getType()
325 {
326 if (is_null($this->type)) {
328 $data = $this->raw(self::FIELD_TYPE);
329 if (is_null($data)) {
330 return null;
331 }
332 $this->type = (string) $data;
333 }
334
335 return $this->type;
336 }
337
345 {
346 if (is_null($this->resourceUserProvidedIdentifiers)) {
348 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
349 if (is_null($data)) {
350 return null;
351 }
352
353 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
354 }
355
357 }
358
359
363 public function setId(?string $id): void
364 {
365 $this->id = $id;
366 }
367
371 public function setVersion(?int $version): void
372 {
373 $this->version = $version;
374 }
375
379 public function setCreatedAt(?DateTimeImmutable $createdAt): void
380 {
381 $this->createdAt = $createdAt;
382 }
383
387 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
388 {
389 $this->lastModifiedAt = $lastModifiedAt;
390 }
391
396 {
397 $this->lastModifiedBy = $lastModifiedBy;
398 }
399
403 public function setCreatedBy(?CreatedBy $createdBy): void
404 {
405 $this->createdBy = $createdBy;
406 }
407
411 public function setSequenceNumber(?int $sequenceNumber): void
412 {
413 $this->sequenceNumber = $sequenceNumber;
414 }
415
419 public function setResource(?Reference $resource): void
420 {
421 $this->resource = $resource;
422 }
423
427 public function setResourceVersion(?int $resourceVersion): void
428 {
429 $this->resourceVersion = $resourceVersion;
430 }
431
436 {
437 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
438 }
439
440
441 #[\ReturnTypeWillChange]
442 public function jsonSerialize()
443 {
444 $data = $this->toArray();
445 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
446 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
447 }
448
449 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
450 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
451 }
452 return (object) $data;
453 }
454}
__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 $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)