- /**
- * Define customer object
- *
- * @param \Magento\Customer\Api\Data\CustomerInterface $customer
- * @return $this
- */
- public function setCustomer(\Magento\Customer\Api\Data\CustomerInterface $customer = null)
- {
- /* @TODO: Remove the method after all external usages are refactored in MAGETWO-19930 */
- $this->_customer = $customer;
- $this->setCustomerId($customer->getId());
- $origAddresses = $customer->getAddresses();
- $customer->setAddresses([]);
- $customerDataFlatArray = $this->objectFactory->create(
- $this->extensibleDataObjectConverter->toFlatArray(
- $customer,
- [],
- '\Magento\Customer\Api\Data\CustomerInterface'
- )
- );
- $customer->setAddresses($origAddresses);
- $this->_objectCopyService->copyFieldsetToTarget('customer_account', 'to_quote', $customerDataFlatArray, $this);
-
- return $this;
- }