commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
BusinessUnitAddressChangedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
30{
31 public const DISCRIMINATOR_VALUE = 'BusinessUnitAddressChanged';
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 $address;
103
104
108 public function __construct(
109 ?string $id = null,
110 ?int $version = null,
111 ?DateTimeImmutable $createdAt = null,
112 ?DateTimeImmutable $lastModifiedAt = null,
114 ?CreatedBy $createdBy = null,
115 ?int $sequenceNumber = null,
116 ?Reference $resource = null,
117 ?int $resourceVersion = null,
119 ?Address $address = null,
120 ?string $type = null
121 ) {
122 $this->id = $id;
123 $this->version = $version;
124 $this->createdAt = $createdAt;
125 $this->lastModifiedAt = $lastModifiedAt;
126 $this->lastModifiedBy = $lastModifiedBy;
127 $this->createdBy = $createdBy;
128 $this->sequenceNumber = $sequenceNumber;
129 $this->resource = $resource;
130 $this->resourceVersion = $resourceVersion;
131 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
132 $this->address = $address;
133 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
134 }
135
142 public function getId()
143 {
144 if (is_null($this->id)) {
146 $data = $this->raw(self::FIELD_ID);
147 if (is_null($data)) {
148 return null;
149 }
150 $this->id = (string) $data;
151 }
152
153 return $this->id;
154 }
155
162 public function getVersion()
163 {
164 if (is_null($this->version)) {
166 $data = $this->raw(self::FIELD_VERSION);
167 if (is_null($data)) {
168 return null;
169 }
170 $this->version = (int) $data;
171 }
172
173 return $this->version;
174 }
175
182 public function getCreatedAt()
183 {
184 if (is_null($this->createdAt)) {
186 $data = $this->raw(self::FIELD_CREATED_AT);
187 if (is_null($data)) {
188 return null;
189 }
190 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
191 if (false === $data) {
192 return null;
193 }
194 $this->createdAt = $data;
195 }
196
197 return $this->createdAt;
198 }
199
206 public function getLastModifiedAt()
207 {
208 if (is_null($this->lastModifiedAt)) {
210 $data = $this->raw(self::FIELD_LAST_MODIFIED_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->lastModifiedAt = $data;
219 }
220
222 }
223
230 public function getLastModifiedBy()
231 {
232 if (is_null($this->lastModifiedBy)) {
234 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
235 if (is_null($data)) {
236 return null;
237 }
238
239 $this->lastModifiedBy = LastModifiedByModel::of($data);
240 }
241
243 }
244
251 public function getCreatedBy()
252 {
253 if (is_null($this->createdBy)) {
255 $data = $this->raw(self::FIELD_CREATED_BY);
256 if (is_null($data)) {
257 return null;
258 }
259
260 $this->createdBy = CreatedByModel::of($data);
261 }
262
263 return $this->createdBy;
264 }
265
273 public function getSequenceNumber()
274 {
275 if (is_null($this->sequenceNumber)) {
277 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
278 if (is_null($data)) {
279 return null;
280 }
281 $this->sequenceNumber = (int) $data;
282 }
283
285 }
286
293 public function getResource()
294 {
295 if (is_null($this->resource)) {
297 $data = $this->raw(self::FIELD_RESOURCE);
298 if (is_null($data)) {
299 return null;
300 }
301 $className = ReferenceModel::resolveDiscriminatorClass($data);
302 $this->resource = $className::of($data);
303 }
304
305 return $this->resource;
306 }
307
314 public function getResourceVersion()
315 {
316 if (is_null($this->resourceVersion)) {
318 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
319 if (is_null($data)) {
320 return null;
321 }
322 $this->resourceVersion = (int) $data;
323 }
324
326 }
327
334 public function getType()
335 {
336 if (is_null($this->type)) {
338 $data = $this->raw(self::FIELD_TYPE);
339 if (is_null($data)) {
340 return null;
341 }
342 $this->type = (string) $data;
343 }
344
345 return $this->type;
346 }
347
355 {
356 if (is_null($this->resourceUserProvidedIdentifiers)) {
358 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
359 if (is_null($data)) {
360 return null;
361 }
362
363 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
364 }
365
367 }
368
375 public function getAddress()
376 {
377 if (is_null($this->address)) {
379 $data = $this->raw(self::FIELD_ADDRESS);
380 if (is_null($data)) {
381 return null;
382 }
383
384 $this->address = AddressModel::of($data);
385 }
386
387 return $this->address;
388 }
389
390
394 public function setId(?string $id): void
395 {
396 $this->id = $id;
397 }
398
402 public function setVersion(?int $version): void
403 {
404 $this->version = $version;
405 }
406
410 public function setCreatedAt(?DateTimeImmutable $createdAt): void
411 {
412 $this->createdAt = $createdAt;
413 }
414
418 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
419 {
420 $this->lastModifiedAt = $lastModifiedAt;
421 }
422
427 {
428 $this->lastModifiedBy = $lastModifiedBy;
429 }
430
434 public function setCreatedBy(?CreatedBy $createdBy): void
435 {
436 $this->createdBy = $createdBy;
437 }
438
442 public function setSequenceNumber(?int $sequenceNumber): void
443 {
444 $this->sequenceNumber = $sequenceNumber;
445 }
446
450 public function setResource(?Reference $resource): void
451 {
452 $this->resource = $resource;
453 }
454
458 public function setResourceVersion(?int $resourceVersion): void
459 {
460 $this->resourceVersion = $resourceVersion;
461 }
462
467 {
468 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
469 }
470
474 public function setAddress(?Address $address): void
475 {
476 $this->address = $address;
477 }
478
479
480 #[\ReturnTypeWillChange]
481 public function jsonSerialize()
482 {
483 $data = $this->toArray();
484 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
485 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
486 }
487
488 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
489 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
490 }
491 return (object) $data;
492 }
493}
__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, ?Address $address=null, ?string $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)