commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MyCustomerDraftModel.php
1<?php
2
3declare(strict_types=1);
10
19use DateTimeImmutable;
20use stdClass;
21
26{
31 protected $email;
32
37 protected $password;
38
43 protected $firstName;
44
49 protected $lastName;
50
55 protected $middleName;
56
61 protected $title;
62
67 protected $salutation;
68
73 protected $dateOfBirth;
74
79 protected $companyName;
80
85 protected $vatId;
86
91 protected $addresses;
92
98
104
109 protected $custom;
110
115 protected $locale;
116
121 protected $stores;
122
123
127 public function __construct(
128 ?string $email = null,
129 ?string $password = null,
130 ?string $firstName = null,
131 ?string $lastName = null,
132 ?string $middleName = null,
133 ?string $title = null,
134 ?string $salutation = null,
135 ?DateTimeImmutable $dateOfBirth = null,
136 ?string $companyName = null,
137 ?string $vatId = null,
139 ?int $defaultShippingAddress = null,
140 ?int $defaultBillingAddress = null,
142 ?string $locale = null,
144 ) {
145 $this->email = $email;
146 $this->password = $password;
147 $this->firstName = $firstName;
148 $this->lastName = $lastName;
149 $this->middleName = $middleName;
150 $this->title = $title;
151 $this->salutation = $salutation;
152 $this->dateOfBirth = $dateOfBirth;
153 $this->companyName = $companyName;
154 $this->vatId = $vatId;
155 $this->addresses = $addresses;
156 $this->defaultShippingAddress = $defaultShippingAddress;
157 $this->defaultBillingAddress = $defaultBillingAddress;
158 $this->custom = $custom;
159 $this->locale = $locale;
160 $this->stores = $stores;
161 }
162
170 public function getEmail()
171 {
172 if (is_null($this->email)) {
174 $data = $this->raw(self::FIELD_EMAIL);
175 if (is_null($data)) {
176 return null;
177 }
178 $this->email = (string) $data;
179 }
180
181 return $this->email;
182 }
183
190 public function getPassword()
191 {
192 if (is_null($this->password)) {
194 $data = $this->raw(self::FIELD_PASSWORD);
195 if (is_null($data)) {
196 return null;
197 }
198 $this->password = (string) $data;
199 }
200
201 return $this->password;
202 }
203
210 public function getFirstName()
211 {
212 if (is_null($this->firstName)) {
214 $data = $this->raw(self::FIELD_FIRST_NAME);
215 if (is_null($data)) {
216 return null;
217 }
218 $this->firstName = (string) $data;
219 }
220
221 return $this->firstName;
222 }
223
230 public function getLastName()
231 {
232 if (is_null($this->lastName)) {
234 $data = $this->raw(self::FIELD_LAST_NAME);
235 if (is_null($data)) {
236 return null;
237 }
238 $this->lastName = (string) $data;
239 }
240
241 return $this->lastName;
242 }
243
250 public function getMiddleName()
251 {
252 if (is_null($this->middleName)) {
254 $data = $this->raw(self::FIELD_MIDDLE_NAME);
255 if (is_null($data)) {
256 return null;
257 }
258 $this->middleName = (string) $data;
259 }
260
261 return $this->middleName;
262 }
263
270 public function getTitle()
271 {
272 if (is_null($this->title)) {
274 $data = $this->raw(self::FIELD_TITLE);
275 if (is_null($data)) {
276 return null;
277 }
278 $this->title = (string) $data;
279 }
280
281 return $this->title;
282 }
283
290 public function getSalutation()
291 {
292 if (is_null($this->salutation)) {
294 $data = $this->raw(self::FIELD_SALUTATION);
295 if (is_null($data)) {
296 return null;
297 }
298 $this->salutation = (string) $data;
299 }
300
301 return $this->salutation;
302 }
303
310 public function getDateOfBirth()
311 {
312 if (is_null($this->dateOfBirth)) {
314 $data = $this->raw(self::FIELD_DATE_OF_BIRTH);
315 if (is_null($data)) {
316 return null;
317 }
318 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
319 if (false === $data) {
320 return null;
321 }
322 $this->dateOfBirth = $data;
323 }
324
325 return $this->dateOfBirth;
326 }
327
334 public function getCompanyName()
335 {
336 if (is_null($this->companyName)) {
338 $data = $this->raw(self::FIELD_COMPANY_NAME);
339 if (is_null($data)) {
340 return null;
341 }
342 $this->companyName = (string) $data;
343 }
344
345 return $this->companyName;
346 }
347
354 public function getVatId()
355 {
356 if (is_null($this->vatId)) {
358 $data = $this->raw(self::FIELD_VAT_ID);
359 if (is_null($data)) {
360 return null;
361 }
362 $this->vatId = (string) $data;
363 }
364
365 return $this->vatId;
366 }
367
374 public function getAddresses()
375 {
376 if (is_null($this->addresses)) {
378 $data = $this->raw(self::FIELD_ADDRESSES);
379 if (is_null($data)) {
380 return null;
381 }
382 $this->addresses = BaseAddressCollection::fromArray($data);
383 }
384
385 return $this->addresses;
386 }
387
396 {
397 if (is_null($this->defaultShippingAddress)) {
399 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
400 if (is_null($data)) {
401 return null;
402 }
403 $this->defaultShippingAddress = (int) $data;
404 }
405
407 }
408
416 public function getDefaultBillingAddress()
417 {
418 if (is_null($this->defaultBillingAddress)) {
420 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
421 if (is_null($data)) {
422 return null;
423 }
424 $this->defaultBillingAddress = (int) $data;
425 }
426
428 }
429
436 public function getCustom()
437 {
438 if (is_null($this->custom)) {
440 $data = $this->raw(self::FIELD_CUSTOM);
441 if (is_null($data)) {
442 return null;
443 }
444
445 $this->custom = CustomFieldsDraftModel::of($data);
446 }
447
448 return $this->custom;
449 }
450
457 public function getLocale()
458 {
459 if (is_null($this->locale)) {
461 $data = $this->raw(self::FIELD_LOCALE);
462 if (is_null($data)) {
463 return null;
464 }
465 $this->locale = (string) $data;
466 }
467
468 return $this->locale;
469 }
470
477 public function getStores()
478 {
479 if (is_null($this->stores)) {
481 $data = $this->raw(self::FIELD_STORES);
482 if (is_null($data)) {
483 return null;
484 }
485 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
486 }
487
488 return $this->stores;
489 }
490
491
495 public function setEmail(?string $email): void
496 {
497 $this->email = $email;
498 }
499
503 public function setPassword(?string $password): void
504 {
505 $this->password = $password;
506 }
507
511 public function setFirstName(?string $firstName): void
512 {
513 $this->firstName = $firstName;
514 }
515
519 public function setLastName(?string $lastName): void
520 {
521 $this->lastName = $lastName;
522 }
523
527 public function setMiddleName(?string $middleName): void
528 {
529 $this->middleName = $middleName;
530 }
531
535 public function setTitle(?string $title): void
536 {
537 $this->title = $title;
538 }
539
543 public function setSalutation(?string $salutation): void
544 {
545 $this->salutation = $salutation;
546 }
547
551 public function setDateOfBirth(?DateTimeImmutable $dateOfBirth): void
552 {
553 $this->dateOfBirth = $dateOfBirth;
554 }
555
559 public function setCompanyName(?string $companyName): void
560 {
561 $this->companyName = $companyName;
562 }
563
567 public function setVatId(?string $vatId): void
568 {
569 $this->vatId = $vatId;
570 }
571
576 {
577 $this->addresses = $addresses;
578 }
579
584 {
585 $this->defaultShippingAddress = $defaultShippingAddress;
586 }
587
592 {
593 $this->defaultBillingAddress = $defaultBillingAddress;
594 }
595
599 public function setCustom(?CustomFieldsDraft $custom): void
600 {
601 $this->custom = $custom;
602 }
603
607 public function setLocale(?string $locale): void
608 {
609 $this->locale = $locale;
610 }
611
616 {
617 $this->stores = $stores;
618 }
619
620
621 #[\ReturnTypeWillChange]
622 public function jsonSerialize()
623 {
624 $data = $this->toArray();
625 if (isset($data[MyCustomerDraft::FIELD_DATE_OF_BIRTH]) && $data[MyCustomerDraft::FIELD_DATE_OF_BIRTH] instanceof \DateTimeImmutable) {
627 }
628 return (object) $data;
629 }
630}
__construct(?string $email=null, ?string $password=null, ?string $firstName=null, ?string $lastName=null, ?string $middleName=null, ?string $title=null, ?string $salutation=null, ?DateTimeImmutable $dateOfBirth=null, ?string $companyName=null, ?string $vatId=null, ?BaseAddressCollection $addresses=null, ?int $defaultShippingAddress=null, ?int $defaultBillingAddress=null, ?CustomFieldsDraft $custom=null, ?string $locale=null, ?StoreResourceIdentifierCollection $stores=null)
setStores(?StoreResourceIdentifierCollection $stores)