commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerImportModel.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
29{
34 protected $key;
35
40 protected $customerNumber;
41
46 protected $email;
47
52 protected $password;
53
58 protected $stores;
59
64 protected $firstName;
65
70 protected $lastName;
71
76 protected $middleName;
77
82 protected $title;
83
88 protected $salutation;
89
94 protected $externalId;
95
100 protected $dateOfBirth;
101
106 protected $companyName;
107
112 protected $vatId;
113
119
124 protected $customerGroup;
125
130 protected $addresses;
131
137
143
149
155
160 protected $locale;
161
166 protected $custom;
167
173
174
178 public function __construct(
179 ?string $key = null,
180 ?string $customerNumber = null,
181 ?string $email = null,
182 ?string $password = null,
184 ?string $firstName = null,
185 ?string $lastName = null,
186 ?string $middleName = null,
187 ?string $title = null,
188 ?string $salutation = null,
189 ?string $externalId = null,
190 ?DateTimeImmutable $dateOfBirth = null,
191 ?string $companyName = null,
192 ?string $vatId = null,
193 ?bool $isEmailVerified = null,
196 ?int $defaultBillingAddress = null,
197 ?array $billingAddresses = null,
198 ?int $defaultShippingAddress = null,
199 ?array $shippingAddresses = null,
200 ?string $locale = null,
201 ?Custom $custom = null,
202 ?string $authenticationMode = null
203 ) {
204 $this->key = $key;
205 $this->customerNumber = $customerNumber;
206 $this->email = $email;
207 $this->password = $password;
208 $this->stores = $stores;
209 $this->firstName = $firstName;
210 $this->lastName = $lastName;
211 $this->middleName = $middleName;
212 $this->title = $title;
213 $this->salutation = $salutation;
214 $this->externalId = $externalId;
215 $this->dateOfBirth = $dateOfBirth;
216 $this->companyName = $companyName;
217 $this->vatId = $vatId;
218 $this->isEmailVerified = $isEmailVerified;
219 $this->customerGroup = $customerGroup;
220 $this->addresses = $addresses;
221 $this->defaultBillingAddress = $defaultBillingAddress;
222 $this->billingAddresses = $billingAddresses;
223 $this->defaultShippingAddress = $defaultShippingAddress;
224 $this->shippingAddresses = $shippingAddresses;
225 $this->locale = $locale;
226 $this->custom = $custom;
227 $this->authenticationMode = $authenticationMode;
228 }
229
236 public function getKey()
237 {
238 if (is_null($this->key)) {
240 $data = $this->raw(self::FIELD_KEY);
241 if (is_null($data)) {
242 return null;
243 }
244 $this->key = (string) $data;
245 }
246
247 return $this->key;
248 }
249
256 public function getCustomerNumber()
257 {
258 if (is_null($this->customerNumber)) {
260 $data = $this->raw(self::FIELD_CUSTOMER_NUMBER);
261 if (is_null($data)) {
262 return null;
263 }
264 $this->customerNumber = (string) $data;
265 }
266
268 }
269
276 public function getEmail()
277 {
278 if (is_null($this->email)) {
280 $data = $this->raw(self::FIELD_EMAIL);
281 if (is_null($data)) {
282 return null;
283 }
284 $this->email = (string) $data;
285 }
286
287 return $this->email;
288 }
289
296 public function getPassword()
297 {
298 if (is_null($this->password)) {
300 $data = $this->raw(self::FIELD_PASSWORD);
301 if (is_null($data)) {
302 return null;
303 }
304 $this->password = (string) $data;
305 }
306
307 return $this->password;
308 }
309
316 public function getStores()
317 {
318 if (is_null($this->stores)) {
320 $data = $this->raw(self::FIELD_STORES);
321 if (is_null($data)) {
322 return null;
323 }
324 $this->stores = StoreKeyReferenceCollection::fromArray($data);
325 }
326
327 return $this->stores;
328 }
329
336 public function getFirstName()
337 {
338 if (is_null($this->firstName)) {
340 $data = $this->raw(self::FIELD_FIRST_NAME);
341 if (is_null($data)) {
342 return null;
343 }
344 $this->firstName = (string) $data;
345 }
346
347 return $this->firstName;
348 }
349
356 public function getLastName()
357 {
358 if (is_null($this->lastName)) {
360 $data = $this->raw(self::FIELD_LAST_NAME);
361 if (is_null($data)) {
362 return null;
363 }
364 $this->lastName = (string) $data;
365 }
366
367 return $this->lastName;
368 }
369
376 public function getMiddleName()
377 {
378 if (is_null($this->middleName)) {
380 $data = $this->raw(self::FIELD_MIDDLE_NAME);
381 if (is_null($data)) {
382 return null;
383 }
384 $this->middleName = (string) $data;
385 }
386
387 return $this->middleName;
388 }
389
396 public function getTitle()
397 {
398 if (is_null($this->title)) {
400 $data = $this->raw(self::FIELD_TITLE);
401 if (is_null($data)) {
402 return null;
403 }
404 $this->title = (string) $data;
405 }
406
407 return $this->title;
408 }
409
416 public function getSalutation()
417 {
418 if (is_null($this->salutation)) {
420 $data = $this->raw(self::FIELD_SALUTATION);
421 if (is_null($data)) {
422 return null;
423 }
424 $this->salutation = (string) $data;
425 }
426
427 return $this->salutation;
428 }
429
436 public function getExternalId()
437 {
438 if (is_null($this->externalId)) {
440 $data = $this->raw(self::FIELD_EXTERNAL_ID);
441 if (is_null($data)) {
442 return null;
443 }
444 $this->externalId = (string) $data;
445 }
446
447 return $this->externalId;
448 }
449
456 public function getDateOfBirth()
457 {
458 if (is_null($this->dateOfBirth)) {
460 $data = $this->raw(self::FIELD_DATE_OF_BIRTH);
461 if (is_null($data)) {
462 return null;
463 }
464 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
465 if (false === $data) {
466 return null;
467 }
468 $this->dateOfBirth = $data;
469 }
470
471 return $this->dateOfBirth;
472 }
473
480 public function getCompanyName()
481 {
482 if (is_null($this->companyName)) {
484 $data = $this->raw(self::FIELD_COMPANY_NAME);
485 if (is_null($data)) {
486 return null;
487 }
488 $this->companyName = (string) $data;
489 }
490
491 return $this->companyName;
492 }
493
500 public function getVatId()
501 {
502 if (is_null($this->vatId)) {
504 $data = $this->raw(self::FIELD_VAT_ID);
505 if (is_null($data)) {
506 return null;
507 }
508 $this->vatId = (string) $data;
509 }
510
511 return $this->vatId;
512 }
513
520 public function getIsEmailVerified()
521 {
522 if (is_null($this->isEmailVerified)) {
524 $data = $this->raw(self::FIELD_IS_EMAIL_VERIFIED);
525 if (is_null($data)) {
526 return null;
527 }
528 $this->isEmailVerified = (bool) $data;
529 }
530
532 }
533
540 public function getCustomerGroup()
541 {
542 if (is_null($this->customerGroup)) {
544 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
545 if (is_null($data)) {
546 return null;
547 }
548
549 $this->customerGroup = CustomerGroupKeyReferenceModel::of($data);
550 }
551
553 }
554
561 public function getAddresses()
562 {
563 if (is_null($this->addresses)) {
565 $data = $this->raw(self::FIELD_ADDRESSES);
566 if (is_null($data)) {
567 return null;
568 }
569 $this->addresses = CustomerAddressCollection::fromArray($data);
570 }
571
572 return $this->addresses;
573 }
574
581 public function getDefaultBillingAddress()
582 {
583 if (is_null($this->defaultBillingAddress)) {
585 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
586 if (is_null($data)) {
587 return null;
588 }
589 $this->defaultBillingAddress = (int) $data;
590 }
591
593 }
594
601 public function getBillingAddresses()
602 {
603 if (is_null($this->billingAddresses)) {
605 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
606 if (is_null($data)) {
607 return null;
608 }
609 $this->billingAddresses = $data;
610 }
611
613 }
614
622 {
623 if (is_null($this->defaultShippingAddress)) {
625 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
626 if (is_null($data)) {
627 return null;
628 }
629 $this->defaultShippingAddress = (int) $data;
630 }
631
633 }
634
641 public function getShippingAddresses()
642 {
643 if (is_null($this->shippingAddresses)) {
645 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
646 if (is_null($data)) {
647 return null;
648 }
649 $this->shippingAddresses = $data;
650 }
651
653 }
654
661 public function getLocale()
662 {
663 if (is_null($this->locale)) {
665 $data = $this->raw(self::FIELD_LOCALE);
666 if (is_null($data)) {
667 return null;
668 }
669 $this->locale = (string) $data;
670 }
671
672 return $this->locale;
673 }
674
681 public function getCustom()
682 {
683 if (is_null($this->custom)) {
685 $data = $this->raw(self::FIELD_CUSTOM);
686 if (is_null($data)) {
687 return null;
688 }
689
690 $this->custom = CustomModel::of($data);
691 }
692
693 return $this->custom;
694 }
695
705 public function getAuthenticationMode()
706 {
707 if (is_null($this->authenticationMode)) {
709 $data = $this->raw(self::FIELD_AUTHENTICATION_MODE);
710 if (is_null($data)) {
711 return null;
712 }
713 $this->authenticationMode = (string) $data;
714 }
715
717 }
718
719
723 public function setKey(?string $key): void
724 {
725 $this->key = $key;
726 }
727
731 public function setCustomerNumber(?string $customerNumber): void
732 {
733 $this->customerNumber = $customerNumber;
734 }
735
739 public function setEmail(?string $email): void
740 {
741 $this->email = $email;
742 }
743
747 public function setPassword(?string $password): void
748 {
749 $this->password = $password;
750 }
751
756 {
757 $this->stores = $stores;
758 }
759
763 public function setFirstName(?string $firstName): void
764 {
765 $this->firstName = $firstName;
766 }
767
771 public function setLastName(?string $lastName): void
772 {
773 $this->lastName = $lastName;
774 }
775
779 public function setMiddleName(?string $middleName): void
780 {
781 $this->middleName = $middleName;
782 }
783
787 public function setTitle(?string $title): void
788 {
789 $this->title = $title;
790 }
791
795 public function setSalutation(?string $salutation): void
796 {
797 $this->salutation = $salutation;
798 }
799
803 public function setExternalId(?string $externalId): void
804 {
805 $this->externalId = $externalId;
806 }
807
811 public function setDateOfBirth(?DateTimeImmutable $dateOfBirth): void
812 {
813 $this->dateOfBirth = $dateOfBirth;
814 }
815
819 public function setCompanyName(?string $companyName): void
820 {
821 $this->companyName = $companyName;
822 }
823
827 public function setVatId(?string $vatId): void
828 {
829 $this->vatId = $vatId;
830 }
831
835 public function setIsEmailVerified(?bool $isEmailVerified): void
836 {
837 $this->isEmailVerified = $isEmailVerified;
838 }
839
844 {
845 $this->customerGroup = $customerGroup;
846 }
847
852 {
853 $this->addresses = $addresses;
854 }
855
860 {
861 $this->defaultBillingAddress = $defaultBillingAddress;
862 }
863
867 public function setBillingAddresses(?array $billingAddresses): void
868 {
869 $this->billingAddresses = $billingAddresses;
870 }
871
876 {
877 $this->defaultShippingAddress = $defaultShippingAddress;
878 }
879
883 public function setShippingAddresses(?array $shippingAddresses): void
884 {
885 $this->shippingAddresses = $shippingAddresses;
886 }
887
891 public function setLocale(?string $locale): void
892 {
893 $this->locale = $locale;
894 }
895
899 public function setCustom(?Custom $custom): void
900 {
901 $this->custom = $custom;
902 }
903
907 public function setAuthenticationMode(?string $authenticationMode): void
908 {
909 $this->authenticationMode = $authenticationMode;
910 }
911
912
913 #[\ReturnTypeWillChange]
914 public function jsonSerialize()
915 {
916 $data = $this->toArray();
917 if (isset($data[CustomerImport::FIELD_DATE_OF_BIRTH]) && $data[CustomerImport::FIELD_DATE_OF_BIRTH] instanceof \DateTimeImmutable) {
919 }
920 return (object) $data;
921 }
922}
setCustomerGroup(?CustomerGroupKeyReference $customerGroup)
__construct(?string $key=null, ?string $customerNumber=null, ?string $email=null, ?string $password=null, ?StoreKeyReferenceCollection $stores=null, ?string $firstName=null, ?string $lastName=null, ?string $middleName=null, ?string $title=null, ?string $salutation=null, ?string $externalId=null, ?DateTimeImmutable $dateOfBirth=null, ?string $companyName=null, ?string $vatId=null, ?bool $isEmailVerified=null, ?CustomerGroupKeyReference $customerGroup=null, ?CustomerAddressCollection $addresses=null, ?int $defaultBillingAddress=null, ?array $billingAddresses=null, ?int $defaultShippingAddress=null, ?array $shippingAddresses=null, ?string $locale=null, ?Custom $custom=null, ?string $authenticationMode=null)
static fromArray(array $data)