Class Customer
Definition at line 18 of file CustomerManagement.php.
◆ __construct()
__construct |
( |
CustomerRepository |
$customerRepository, |
|
|
CustomerAddressRepository |
$customerAddressRepository, |
|
|
AccountManagement |
$accountManagement, |
|
|
\Magento\Framework\Validator\Factory |
$validatorFactory = null , |
|
|
\Magento\Customer\Model\AddressFactory |
$addressFactory = null |
|
) |
| |
CustomerManagement constructor.
- Parameters
-
CustomerRepository | $customerRepository | |
CustomerAddressRepository | $customerAddressRepository | |
AccountManagement | $accountManagement | |
\Magento\Framework\Validator\Factory | null | $validatorFactory | |
\Magento\Customer\Model\AddressFactory | null | $addressFactory | |
Definition at line 53 of file CustomerManagement.php.
66 ->get(\
Magento\Customer\Model\AddressFactory::class);
$customerAddressRepository
◆ populateCustomerInfo()
populateCustomerInfo |
( |
QuoteEntity |
$quote | ) |
|
Populate customer model
- Parameters
-
- Returns
- void
Definition at line 75 of file CustomerManagement.php.
80 $customer = $this->accountManagement->createAccountWithPasswordHash(
86 if (!
$quote->getBillingAddress()->getId() &&
$customer->getDefaultBilling()) {
87 $quote->getBillingAddress()->importCustomerAddressData(
88 $this->customerAddressRepository->getById(
$customer->getDefaultBilling())
90 $quote->getBillingAddress()->setCustomerAddressId(
$customer->getDefaultBilling());
92 if (!
$quote->getShippingAddress()->getSameAsBilling()
93 && !
$quote->getBillingAddress()->getId()
96 $quote->getShippingAddress()->importCustomerAddressData(
97 $this->customerAddressRepository->getById(
$customer->getDefaultShipping())
99 $quote->getShippingAddress()->setCustomerAddressId(
$customer->getDefaultShipping());
◆ validateAddresses()
validateAddresses |
( |
QuoteEntity |
$quote | ) |
|
Validate Quote Addresses
- Parameters
-
- Exceptions
-
Definition at line 110 of file CustomerManagement.php.
113 if (
$quote->getBillingAddress()->getCustomerAddressId()) {
114 $addresses[] = $this->customerAddressRepository->getById(
115 $quote->getBillingAddress()->getCustomerAddressId()
118 if (
$quote->getShippingAddress()->getCustomerAddressId()) {
119 $addresses[] = $this->customerAddressRepository->getById(
120 $quote->getShippingAddress()->getCustomerAddressId()
125 $validator = $this->validatorFactory->createValidator(
'customer_address',
'save');
126 $addressModel = $this->addressFactory->create();
127 $addressModel->updateData(
$address);
128 if (!$validator->isValid($addressModel)) {
129 throw new \Magento\Framework\Validator\Exception(
132 $validator->getMessages()
◆ $accountManagement
◆ $customerAddressRepository
$customerAddressRepository |
|
protected |
◆ $customerRepository
The documentation for this class was generated from the following file: