commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerDraftModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
29final class CustomerDraftModel extends JsonObjectModel implements CustomerDraft
30{
35 protected $key;
36
41 protected $customerNumber;
42
47 protected $externalId;
48
53 protected $email;
54
59 protected $password;
60
65 protected $firstName;
66
71 protected $lastName;
72
77 protected $middleName;
78
83 protected $title;
84
90
95 protected $anonymousCart;
96
101 protected $anonymousId;
102
107 protected $dateOfBirth;
108
113 protected $companyName;
114
119 protected $vatId;
120
125 protected $addresses;
126
132
138
144
150
156
161 protected $customerGroup;
162
168
173 protected $custom;
174
179 protected $locale;
180
185 protected $salutation;
186
191 protected $stores;
192
198
199
203 public function __construct(
204 ?string $key = null,
205 ?string $customerNumber = null,
206 ?string $externalId = null,
207 ?string $email = null,
208 ?string $password = null,
209 ?string $firstName = null,
210 ?string $lastName = null,
211 ?string $middleName = null,
212 ?string $title = null,
213 ?string $anonymousCartId = null,
215 ?string $anonymousId = null,
216 ?DateTimeImmutable $dateOfBirth = null,
217 ?string $companyName = null,
218 ?string $vatId = null,
220 ?int $defaultShippingAddress = null,
221 ?array $shippingAddresses = null,
222 ?int $defaultBillingAddress = null,
223 ?array $billingAddresses = null,
224 ?bool $isEmailVerified = null,
228 ?string $locale = null,
229 ?string $salutation = null,
231 ?string $authenticationMode = null
232 ) {
233 $this->key = $key;
234 $this->customerNumber = $customerNumber;
235 $this->externalId = $externalId;
236 $this->email = $email;
237 $this->password = $password;
238 $this->firstName = $firstName;
239 $this->lastName = $lastName;
240 $this->middleName = $middleName;
241 $this->title = $title;
242 $this->anonymousCartId = $anonymousCartId;
243 $this->anonymousCart = $anonymousCart;
244 $this->anonymousId = $anonymousId;
245 $this->dateOfBirth = $dateOfBirth;
246 $this->companyName = $companyName;
247 $this->vatId = $vatId;
248 $this->addresses = $addresses;
249 $this->defaultShippingAddress = $defaultShippingAddress;
250 $this->shippingAddresses = $shippingAddresses;
251 $this->defaultBillingAddress = $defaultBillingAddress;
252 $this->billingAddresses = $billingAddresses;
253 $this->isEmailVerified = $isEmailVerified;
254 $this->customerGroup = $customerGroup;
255 $this->customerGroupAssignments = $customerGroupAssignments;
256 $this->custom = $custom;
257 $this->locale = $locale;
258 $this->salutation = $salutation;
259 $this->stores = $stores;
260 $this->authenticationMode = $authenticationMode;
261 }
262
271 public function getKey()
272 {
273 if (is_null($this->key)) {
275 $data = $this->raw(self::FIELD_KEY);
276 if (is_null($data)) {
277 return null;
278 }
279 $this->key = (string) $data;
280 }
281
282 return $this->key;
283 }
284
293 public function getCustomerNumber()
294 {
295 if (is_null($this->customerNumber)) {
297 $data = $this->raw(self::FIELD_CUSTOMER_NUMBER);
298 if (is_null($data)) {
299 return null;
300 }
301 $this->customerNumber = (string) $data;
302 }
303
305 }
306
313 public function getExternalId()
314 {
315 if (is_null($this->externalId)) {
317 $data = $this->raw(self::FIELD_EXTERNAL_ID);
318 if (is_null($data)) {
319 return null;
320 }
321 $this->externalId = (string) $data;
322 }
323
324 return $this->externalId;
325 }
326
334 public function getEmail()
335 {
336 if (is_null($this->email)) {
338 $data = $this->raw(self::FIELD_EMAIL);
339 if (is_null($data)) {
340 return null;
341 }
342 $this->email = (string) $data;
343 }
344
345 return $this->email;
346 }
347
355 public function getPassword()
356 {
357 if (is_null($this->password)) {
359 $data = $this->raw(self::FIELD_PASSWORD);
360 if (is_null($data)) {
361 return null;
362 }
363 $this->password = (string) $data;
364 }
365
366 return $this->password;
367 }
368
375 public function getFirstName()
376 {
377 if (is_null($this->firstName)) {
379 $data = $this->raw(self::FIELD_FIRST_NAME);
380 if (is_null($data)) {
381 return null;
382 }
383 $this->firstName = (string) $data;
384 }
385
386 return $this->firstName;
387 }
388
395 public function getLastName()
396 {
397 if (is_null($this->lastName)) {
399 $data = $this->raw(self::FIELD_LAST_NAME);
400 if (is_null($data)) {
401 return null;
402 }
403 $this->lastName = (string) $data;
404 }
405
406 return $this->lastName;
407 }
408
415 public function getMiddleName()
416 {
417 if (is_null($this->middleName)) {
419 $data = $this->raw(self::FIELD_MIDDLE_NAME);
420 if (is_null($data)) {
421 return null;
422 }
423 $this->middleName = (string) $data;
424 }
425
426 return $this->middleName;
427 }
428
435 public function getTitle()
436 {
437 if (is_null($this->title)) {
439 $data = $this->raw(self::FIELD_TITLE);
440 if (is_null($data)) {
441 return null;
442 }
443 $this->title = (string) $data;
444 }
445
446 return $this->title;
447 }
448
455 public function getAnonymousCartId()
456 {
457 if (is_null($this->anonymousCartId)) {
459 $data = $this->raw(self::FIELD_ANONYMOUS_CART_ID);
460 if (is_null($data)) {
461 return null;
462 }
463 $this->anonymousCartId = (string) $data;
464 }
465
467 }
468
475 public function getAnonymousCart()
476 {
477 if (is_null($this->anonymousCart)) {
479 $data = $this->raw(self::FIELD_ANONYMOUS_CART);
480 if (is_null($data)) {
481 return null;
482 }
483
484 $this->anonymousCart = CartResourceIdentifierModel::of($data);
485 }
486
488 }
489
497 public function getAnonymousId()
498 {
499 if (is_null($this->anonymousId)) {
501 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
502 if (is_null($data)) {
503 return null;
504 }
505 $this->anonymousId = (string) $data;
506 }
507
508 return $this->anonymousId;
509 }
510
517 public function getDateOfBirth()
518 {
519 if (is_null($this->dateOfBirth)) {
521 $data = $this->raw(self::FIELD_DATE_OF_BIRTH);
522 if (is_null($data)) {
523 return null;
524 }
525 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
526 if (false === $data) {
527 return null;
528 }
529 $this->dateOfBirth = $data;
530 }
531
532 return $this->dateOfBirth;
533 }
534
541 public function getCompanyName()
542 {
543 if (is_null($this->companyName)) {
545 $data = $this->raw(self::FIELD_COMPANY_NAME);
546 if (is_null($data)) {
547 return null;
548 }
549 $this->companyName = (string) $data;
550 }
551
552 return $this->companyName;
553 }
554
561 public function getVatId()
562 {
563 if (is_null($this->vatId)) {
565 $data = $this->raw(self::FIELD_VAT_ID);
566 if (is_null($data)) {
567 return null;
568 }
569 $this->vatId = (string) $data;
570 }
571
572 return $this->vatId;
573 }
574
581 public function getAddresses()
582 {
583 if (is_null($this->addresses)) {
585 $data = $this->raw(self::FIELD_ADDRESSES);
586 if (is_null($data)) {
587 return null;
588 }
589 $this->addresses = BaseAddressCollection::fromArray($data);
590 }
591
592 return $this->addresses;
593 }
594
603 {
604 if (is_null($this->defaultShippingAddress)) {
606 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
607 if (is_null($data)) {
608 return null;
609 }
610 $this->defaultShippingAddress = (int) $data;
611 }
612
614 }
615
623 public function getShippingAddresses()
624 {
625 if (is_null($this->shippingAddresses)) {
627 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
628 if (is_null($data)) {
629 return null;
630 }
631 $this->shippingAddresses = $data;
632 }
633
635 }
636
644 public function getDefaultBillingAddress()
645 {
646 if (is_null($this->defaultBillingAddress)) {
648 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
649 if (is_null($data)) {
650 return null;
651 }
652 $this->defaultBillingAddress = (int) $data;
653 }
654
656 }
657
665 public function getBillingAddresses()
666 {
667 if (is_null($this->billingAddresses)) {
669 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
670 if (is_null($data)) {
671 return null;
672 }
673 $this->billingAddresses = $data;
674 }
675
677 }
678
686 public function getIsEmailVerified()
687 {
688 if (is_null($this->isEmailVerified)) {
690 $data = $this->raw(self::FIELD_IS_EMAIL_VERIFIED);
691 if (is_null($data)) {
692 return null;
693 }
694 $this->isEmailVerified = (bool) $data;
695 }
696
698 }
699
707 public function getCustomerGroup()
708 {
709 if (is_null($this->customerGroup)) {
711 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
712 if (is_null($data)) {
713 return null;
714 }
715
716 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
717 }
718
720 }
721
730 {
731 if (is_null($this->customerGroupAssignments)) {
733 $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS);
734 if (is_null($data)) {
735 return null;
736 }
737 $this->customerGroupAssignments = CustomerGroupAssignmentDraftCollection::fromArray($data);
738 }
739
741 }
742
749 public function getCustom()
750 {
751 if (is_null($this->custom)) {
753 $data = $this->raw(self::FIELD_CUSTOM);
754 if (is_null($data)) {
755 return null;
756 }
757
758 $this->custom = CustomFieldsDraftModel::of($data);
759 }
760
761 return $this->custom;
762 }
763
771 public function getLocale()
772 {
773 if (is_null($this->locale)) {
775 $data = $this->raw(self::FIELD_LOCALE);
776 if (is_null($data)) {
777 return null;
778 }
779 $this->locale = (string) $data;
780 }
781
782 return $this->locale;
783 }
784
791 public function getSalutation()
792 {
793 if (is_null($this->salutation)) {
795 $data = $this->raw(self::FIELD_SALUTATION);
796 if (is_null($data)) {
797 return null;
798 }
799 $this->salutation = (string) $data;
800 }
801
802 return $this->salutation;
803 }
804
815 public function getStores()
816 {
817 if (is_null($this->stores)) {
819 $data = $this->raw(self::FIELD_STORES);
820 if (is_null($data)) {
821 return null;
822 }
823 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
824 }
825
826 return $this->stores;
827 }
828
838 public function getAuthenticationMode()
839 {
840 if (is_null($this->authenticationMode)) {
842 $data = $this->raw(self::FIELD_AUTHENTICATION_MODE);
843 if (is_null($data)) {
844 return null;
845 }
846 $this->authenticationMode = (string) $data;
847 }
848
850 }
851
852
856 public function setKey(?string $key): void
857 {
858 $this->key = $key;
859 }
860
864 public function setCustomerNumber(?string $customerNumber): void
865 {
866 $this->customerNumber = $customerNumber;
867 }
868
872 public function setExternalId(?string $externalId): void
873 {
874 $this->externalId = $externalId;
875 }
876
880 public function setEmail(?string $email): void
881 {
882 $this->email = $email;
883 }
884
888 public function setPassword(?string $password): void
889 {
890 $this->password = $password;
891 }
892
896 public function setFirstName(?string $firstName): void
897 {
898 $this->firstName = $firstName;
899 }
900
904 public function setLastName(?string $lastName): void
905 {
906 $this->lastName = $lastName;
907 }
908
912 public function setMiddleName(?string $middleName): void
913 {
914 $this->middleName = $middleName;
915 }
916
920 public function setTitle(?string $title): void
921 {
922 $this->title = $title;
923 }
924
928 public function setAnonymousCartId(?string $anonymousCartId): void
929 {
930 $this->anonymousCartId = $anonymousCartId;
931 }
932
937 {
938 $this->anonymousCart = $anonymousCart;
939 }
940
944 public function setAnonymousId(?string $anonymousId): void
945 {
946 $this->anonymousId = $anonymousId;
947 }
948
952 public function setDateOfBirth(?DateTimeImmutable $dateOfBirth): void
953 {
954 $this->dateOfBirth = $dateOfBirth;
955 }
956
960 public function setCompanyName(?string $companyName): void
961 {
962 $this->companyName = $companyName;
963 }
964
968 public function setVatId(?string $vatId): void
969 {
970 $this->vatId = $vatId;
971 }
972
977 {
978 $this->addresses = $addresses;
979 }
980
985 {
986 $this->defaultShippingAddress = $defaultShippingAddress;
987 }
988
992 public function setShippingAddresses(?array $shippingAddresses): void
993 {
994 $this->shippingAddresses = $shippingAddresses;
995 }
996
1001 {
1002 $this->defaultBillingAddress = $defaultBillingAddress;
1003 }
1004
1008 public function setBillingAddresses(?array $billingAddresses): void
1009 {
1010 $this->billingAddresses = $billingAddresses;
1011 }
1012
1016 public function setIsEmailVerified(?bool $isEmailVerified): void
1017 {
1018 $this->isEmailVerified = $isEmailVerified;
1019 }
1020
1025 {
1026 $this->customerGroup = $customerGroup;
1027 }
1028
1033 {
1034 $this->customerGroupAssignments = $customerGroupAssignments;
1035 }
1036
1040 public function setCustom(?CustomFieldsDraft $custom): void
1041 {
1042 $this->custom = $custom;
1043 }
1044
1048 public function setLocale(?string $locale): void
1049 {
1050 $this->locale = $locale;
1051 }
1052
1056 public function setSalutation(?string $salutation): void
1057 {
1058 $this->salutation = $salutation;
1059 }
1060
1065 {
1066 $this->stores = $stores;
1067 }
1068
1072 public function setAuthenticationMode(?string $authenticationMode): void
1073 {
1074 $this->authenticationMode = $authenticationMode;
1075 }
1076
1077
1078 #[\ReturnTypeWillChange]
1079 public function jsonSerialize()
1080 {
1081 $data = $this->toArray();
1082 if (isset($data[CustomerDraft::FIELD_DATE_OF_BIRTH]) && $data[CustomerDraft::FIELD_DATE_OF_BIRTH] instanceof \DateTimeImmutable) {
1084 }
1085 return (object) $data;
1086 }
1087}
setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments)
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
__construct(?string $key=null, ?string $customerNumber=null, ?string $externalId=null, ?string $email=null, ?string $password=null, ?string $firstName=null, ?string $lastName=null, ?string $middleName=null, ?string $title=null, ?string $anonymousCartId=null, ?CartResourceIdentifier $anonymousCart=null, ?string $anonymousId=null, ?DateTimeImmutable $dateOfBirth=null, ?string $companyName=null, ?string $vatId=null, ?BaseAddressCollection $addresses=null, ?int $defaultShippingAddress=null, ?array $shippingAddresses=null, ?int $defaultBillingAddress=null, ?array $billingAddresses=null, ?bool $isEmailVerified=null, ?CustomerGroupResourceIdentifier $customerGroup=null, ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments=null, ?CustomFieldsDraft $custom=null, ?string $locale=null, ?string $salutation=null, ?StoreResourceIdentifierCollection $stores=null, ?string $authenticationMode=null)
setAnonymousCart(?CartResourceIdentifier $anonymousCart)
setStores(?StoreResourceIdentifierCollection $stores)
static fromArray(array $data)