本文整理汇总了PHP中Magento\Customer\Api\Data\CustomerInterfaceFactory类的典型用法代码示例。如果您正苦于以下问题:PHP CustomerInterfaceFactory类的具体用法?PHP CustomerInterfaceFactory怎么用?PHP CustomerInterfaceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomerInterfaceFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
if (!function_exists('libxml_set_external_entity_loader')) {
$this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
}
$this->customer = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\CustomerInterface', [], '', false, true, true);
$this->customer->expects($this->once())->method('getWebsiteId')->willReturn(2);
$this->customerDataFactory = $this->getMock('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory', ['create'], [], '', false);
$this->customerDataFactory->expects($this->once())->method('create')->willReturn($this->customer);
$this->form = $this->getMock('Magento\\Customer\\Model\\Metadata\\Form', [], [], '', false);
$this->request = $this->getMockForAbstractClass('Magento\\Framework\\App\\RequestInterface', [], '', false, true, true, ['getPost']);
$this->response = $this->getMockForAbstractClass('Magento\\Framework\\App\\ResponseInterface', [], '', false);
$this->formFactory = $this->getMock('Magento\\Customer\\Model\\Metadata\\FormFactory', ['create'], [], '', false);
$this->formFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->form);
$this->extensibleDataObjectConverter = $this->getMock('Magento\\Framework\\Api\\ExtensibleDataObjectConverter', [], [], '', false);
$this->dataObjectHelper = $this->getMock('Magento\\Framework\\Api\\DataObjectHelper', [], [], '', false);
$this->dataObjectHelper->expects($this->once())->method('populateWithArray');
$this->customerAccountManagement = $this->getMockForAbstractClass('Magento\\Customer\\Api\\AccountManagementInterface', [], '', false, true, true);
$this->resultJson = $this->getMock('Magento\\Framework\\Controller\\Result\\Json', [], [], '', false);
$this->resultJson->expects($this->once())->method('setData');
$this->resultJsonFactory = $this->getMock('Magento\\Framework\\Controller\\Result\\JsonFactory', ['create'], [], '', false);
$this->resultJsonFactory->expects($this->once())->method('create')->willReturn($this->resultJson);
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->controller = $objectHelper->getObject('Magento\\Customer\\Controller\\Adminhtml\\Index\\Validate', ['request' => $this->request, 'response' => $this->response, 'customerDataFactory' => $this->customerDataFactory, 'formFactory' => $this->formFactory, 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverter, 'customerAccountManagement' => $this->customerAccountManagement, 'resultJsonFactory' => $this->resultJsonFactory, 'dataObjectHelper' => $this->dataObjectHelper]);
}
示例2: create
/**
* {@inheritdoc}
*/
public function create($orderId)
{
$order = $this->orderRepository->get($orderId);
if ($order->getCustomerId()) {
throw new AlreadyExistsException(__("This order already has associated customer account"));
}
$customerData = $this->objectCopyService->copyFieldsetToTarget('order_address', 'to_customer', $order->getBillingAddress(), []);
$addresses = $order->getAddresses();
foreach ($addresses as $address) {
$addressData = $this->objectCopyService->copyFieldsetToTarget('order_address', 'to_customer_address', $address, []);
/** @var \Magento\Customer\Api\Data\AddressInterface $customerAddress */
$customerAddress = $this->addressFactory->create(['data' => $addressData]);
if (is_string($address->getRegion())) {
/** @var \Magento\Customer\Api\Data\RegionInterface $region */
$region = $this->regionFactory->create();
$region->setRegion($address->getRegion());
$region->setRegionCode($address->getRegionCode());
$region->setRegionId($address->getRegionId());
$customerAddress->setRegion($region);
}
$customerData['addresses'][] = $customerAddress;
}
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
$customer = $this->customerFactory->create(['data' => $customerData]);
$account = $this->accountManagement->createAccount($customer);
$order->setCustomerId($account->getId());
$this->orderRepository->save($order);
return $account;
}
示例3: prepareQuoteForNewCustomer
/**
* @param \Magento\Quote\Model\Quote $quote
* @return \Magento\Quote\Model\Quote
*/
public function prepareQuoteForNewCustomer(\Magento\Quote\Model\Quote $quote)
{
$billing = $quote->getBillingAddress();
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
$billing->setDefaultBilling(true);
if ($shipping && !$shipping->getSameAsBilling()) {
$shipping->setDefaultShipping(true);
$address = $shipping->exportCustomerAddress();
$shipping->setCustomerAddressData($address);
} elseif ($shipping) {
$billing->setDefaultShipping(true);
}
$address = $shipping->exportCustomerAddress();
$billing->setCustomerAddressData($address);
foreach (['customer_dob', 'customer_taxvat', 'customer_gender'] as $attribute) {
if ($quote->getData($attribute) && !$billing->getData($attribute)) {
$billing->setData($attribute, $quote->getData($attribute));
}
}
$customer = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $this->copyObject->getDataFromFieldset('checkout_onepage_billing', 'to_customer', $billing), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$customer->setEmail($quote->getCustomerEmail());
$customer->setPrefix($quote->getCustomerPrefix());
$customer->setFirstname($quote->getCustomerFirstname());
$customer->setMiddlename($quote->getCustomerMiddlename());
$customer->setLastname($quote->getCustomerLastname());
$customer->setSuffix($quote->getCustomerSuffix());
$quote->setCustomer($customer);
$quote->addCustomerAddress($billing->exportCustomerAddress());
if ($shipping->hasCustomerAddress()) {
$quote->addCustomerAddress($shipping->exportCustomerAddress());
}
return $quote;
}
示例4: testGetCustomerDepersonalizeCustomerData
/**
* test getCustomer method, method returns depersonalized customer Data
*/
public function testGetCustomerDepersonalizeCustomerData()
{
$this->requestMock->expects($this->once())->method('isAjax')->will($this->returnValue(false));
$this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true));
$this->viewMock->expects($this->once())->method('isLayoutLoaded')->will($this->returnValue(true));
$this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(true));
$this->customerSessionMock->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($this->customerGroupId));
$this->customerInterfaceFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->customerDataMock));
$this->customerDataMock->expects($this->once())->method('setGroupId')->with($this->equalTo($this->customerGroupId))->will($this->returnSelf());
$this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
}
示例5: delete
/**
* {@inheritdoc}
*/
public function delete($id)
{
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
$customer = $this->customerDataFactory->create();
$customer = $this->entityManager->load($customer, $id);
try {
$this->entityManager->delete($customer);
} catch (\Exception $e) {
return false;
}
return true;
}
示例6: testUpdateDataOverrideExistingData
public function testUpdateDataOverrideExistingData()
{
/** @var \Magento\Customer\Model\Data\Customer $customerData */
$customerData = $this->customerFactory->create()->setId(2)->setFirstname('John')->setLastname('Doe')->setDefaultBilling(1);
$this->customerModel->updateData($customerData);
/** @var \Magento\Customer\Model\Data\Customer $updatedCustomerData */
$updatedCustomerData = $this->customerFactory->create()->setId(3)->setFirstname('Jane')->setLastname('Smith')->setDefaultBilling(0);
$updatedCustomerData = $this->customerModel->updateData($updatedCustomerData)->getDataModel();
$this->assertEquals(3, $updatedCustomerData->getId());
$this->assertEquals('Jane', $updatedCustomerData->getFirstname());
$this->assertEquals('Smith', $updatedCustomerData->getLastname());
$this->assertEquals(0, $updatedCustomerData->getDefaultBilling());
}
示例7: getCustomer
/**
* Retrieve Customer instance
*
* @return \Magento\Customer\Api\Data\CustomerInterface
*/
public function getCustomer()
{
if ($this->_customer === null) {
$params = $this->urlDecoder->decode($this->_getRequest()->getParam('data'));
$data = explode(',', $params);
$customerId = abs(intval($data[0]));
if ($customerId && $customerId == $this->_customerSession->getCustomerId()) {
$this->_customer = $this->_customerRepository->getById($customerId);
} else {
$this->_customer = $this->_customerFactory->create();
}
}
return $this->_customer;
}
示例8: testPrepareQuoteForNewCustomer
public function testPrepareQuoteForNewCustomer()
{
$customerAddressMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AddressInterface')->disableOriginalConstructor()->getMock();
$this->addressMock->expects($this->any())->method('exportCustomerAddress')->willReturn($customerAddressMock);
$this->addressMock->expects($this->any())->method('getData')->willReturn([]);
$this->addressFactoryMock->expects($this->any())->method('create')->willReturn($this->addressMock);
$this->quoteMock->expects($this->any())->method('isVirtual')->willReturn(false);
$this->quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($this->addressMock);
$this->quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($this->addressMock);
$customerDataMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
$this->customerFactoryMock->expects($this->once())->method('create')->willReturn($customerDataMock);
$this->copyObjectMock->expects($this->any())->method('getDataFromFieldset')->willReturn([]);
$this->dataObjectHelper->expects($this->any())->method('populateWithArray')->willReturnSelf();
$this->assertInstanceOf('Magento\\Quote\\Model\\Quote', $this->quote->prepareQuoteForNewCustomer($this->quoteMock));
}
示例9: createSampleCustomerDataObject
/**
* Create customer using setters.
*
* @param array $additional
* @return CustomerInterface
*/
public function createSampleCustomerDataObject(array $additional = [])
{
$customerAddress1 = $this->customerAddressFactory->create();
$customerAddress1->setCountryId('US');
$customerAddress1->setIsDefaultBilling(true);
$customerAddress1->setIsDefaultShipping(true);
$customerAddress1->setPostcode('75477');
$customerAddress1->setRegion(Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\Data\\RegionInterfaceFactory')->create()->setRegionCode(self::ADDRESS_REGION_CODE1)->setRegion('Alabama')->setRegionId(1));
$customerAddress1->setStreet(['Green str, 67']);
$customerAddress1->setTelephone('3468676');
$customerAddress1->setCity(self::ADDRESS_CITY1);
$customerAddress1->setFirstname('John');
$customerAddress1->setLastname('Smith');
$address1 = $this->dataObjectProcessor->buildOutputDataArray($customerAddress1, 'Magento\\Customer\\Api\\Data\\AddressInterface');
$customerAddress2 = $this->customerAddressFactory->create();
$customerAddress2->setCountryId('US');
$customerAddress2->setIsDefaultBilling(false);
$customerAddress2->setIsDefaultShipping(false);
$customerAddress2->setPostcode('47676');
$customerAddress2->setRegion(Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\Data\\RegionInterfaceFactory')->create()->setRegionCode(self::ADDRESS_REGION_CODE2)->setRegion('Alabama')->setRegionId(1));
$customerAddress2->setStreet(['Black str, 48', 'Building D']);
$customerAddress2->setTelephone('3234676');
$customerAddress2->setCity(self::ADDRESS_CITY2);
$customerAddress2->setFirstname('John');
$customerAddress2->setLastname('Smith');
$address2 = $this->dataObjectProcessor->buildOutputDataArray($customerAddress2, 'Magento\\Customer\\Api\\Data\\AddressInterface');
$customerData = $this->getCustomerSampleData(array_merge([CustomerData::KEY_ADDRESSES => [$address1, $address2]], $additional));
$customer = $this->customerDataFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
return $customer;
}
示例10: testSetAccountData
public function testSetAccountData()
{
$taxClassId = 1;
$attributes = [['email', 'user@example.com'], ['group_id', 1]];
$attributeMocks = [];
foreach ($attributes as $attribute) {
$attributeMock = $this->getMock('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface', [], [], '', false);
$attributeMock->expects($this->any())->method('getAttributeCode')->will($this->returnValue($attribute[0]));
$attributeMocks[] = $attributeMock;
}
$customerGroupMock = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\GroupInterface', [], '', false, true, true, ['getTaxClassId']);
$customerGroupMock->expects($this->once())->method('getTaxClassId')->will($this->returnValue($taxClassId));
$customerFormMock = $this->getMock('Magento\\Customer\\Model\\Metadata\\Form', [], [], '', false);
$customerFormMock->expects($this->any())->method('getAttributes')->will($this->returnValue($attributeMocks));
$customerFormMock->expects($this->any())->method('extractData')->will($this->returnValue([]));
$customerFormMock->expects($this->any())->method('restoreData')->will($this->returnValue([]));
$customerFormMock->expects($this->any())->method('prepareRequest')->will($this->returnValue($this->getMock('Magento\\Framework\\App\\RequestInterface')));
$customerMock = $this->getMock('Magento\\Customer\\Api\\Data\\CustomerInterface', [], [], '', false);
$this->customerMapper->expects($this->atLeastOnce())->method('toFlatArray')->willReturn(['email' => 'user@example.com', 'group_id' => 1, 'gender' => 1]);
$quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', [], [], '', false);
$quoteMock->expects($this->any())->method('getCustomer')->will($this->returnValue($customerMock));
$quoteMock->expects($this->once())->method('addData')->with(['customer_email' => $attributes[0][1], 'customer_group_id' => $attributes[1][1], 'customer_tax_class_id' => $taxClassId]);
$this->dataObjectHelper->expects($this->once())->method('populateWithArray')->with($customerMock, ['email' => 'user@example.com', 'group_id' => 1, 'gender' => 1], '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$this->formFactoryMock->expects($this->any())->method('create')->will($this->returnValue($customerFormMock));
$this->sessionQuoteMock->expects($this->any())->method('getQuote')->will($this->returnValue($quoteMock));
$this->customerFactoryMock->expects($this->any())->method('create')->will($this->returnValue($customerMock));
$this->groupRepositoryMock->expects($this->once())->method('getById')->will($this->returnValue($customerGroupMock));
$this->adminOrderCreate->setAccountData([]);
}
示例11: install
/**
* {@inheritdoc}
*/
public function install($fixtures)
{
foreach ($fixtures as $fixture) {
$filePath = $this->fixtureManager->getFixture($fixture);
$rows = $this->csvReader->getData($filePath);
$header = array_shift($rows);
foreach ($rows as $row) {
$data = [];
foreach ($row as $key => $value) {
$data[$header[$key]] = $value;
}
$row = $data;
// Collect customer profile and addresses data
$customerData['profile'] = $this->convertRowData($row, $this->getDefaultCustomerProfile());
if (!$this->accountManagement->isEmailAvailable($customerData['profile']['email'])) {
continue;
}
$customerData['address'] = $this->convertRowData($row, $this->getDefaultCustomerAddress());
$customerData['address']['region_id'] = $this->getRegionId($customerData['address']);
$address = $customerData['address'];
$regionData = [RegionInterface::REGION_ID => $address['region_id'], RegionInterface::REGION => !empty($address['region']) ? $address['region'] : null, RegionInterface::REGION_CODE => !empty($address['region_code']) ? $address['region_code'] : null];
$region = $this->regionFactory->create();
$this->dataObjectHelper->populateWithArray($region, $regionData, '\\Magento\\Customer\\Api\\Data\\RegionInterface');
$addresses = $this->addressFactory->create();
unset($customerData['address']['region']);
$this->dataObjectHelper->populateWithArray($addresses, $customerData['address'], '\\Magento\\Customer\\Api\\Data\\AddressInterface');
$addresses->setRegion($region)->setIsDefaultBilling(true)->setIsDefaultShipping(true);
$customer = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $customerData['profile'], '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$customer->setAddresses([$addresses]);
$this->appState->emulateAreaCode('frontend', [$this->accountManagement, 'createAccount'], [$customer, $row['password']]);
}
}
}
示例12: createSampleCustomerDataObject
/**
* Create customer using setters.
*
* @return CustomerInterface
*/
public function createSampleCustomerDataObject()
{
$customerAddress1 = $this->customerAddressFactory->create();
$customerAddress1->setCountryId('US');
$customerAddress1->setIsDefaultBilling(true);
$customerAddress1->setIsDefaultShipping(true);
$customerAddress1->setPostcode('75477');
$customerAddress1->setRegion(Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\Data\\RegionInterfaceFactory')->create()->setRegionCode(self::ADDRESS_REGION_CODE1)->setRegion('Alabama')->setRegionId(1));
$customerAddress1->setStreet(['Green str, 67']);
$customerAddress1->setTelephone('3468676');
$customerAddress1->setCity(self::ADDRESS_CITY1);
$customerAddress1->setFirstname('John');
$customerAddress1->setLastname('Smith');
$address1 = $this->dataObjectProcessor->buildOutputDataArray($customerAddress1, 'Magento\\Customer\\Api\\Data\\AddressInterface');
$customerAddress2 = $this->customerAddressFactory->create();
$customerAddress2->setCountryId('US');
$customerAddress2->setIsDefaultBilling(false);
$customerAddress2->setIsDefaultShipping(false);
$customerAddress2->setPostcode('47676');
$customerAddress2->setRegion(Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\Data\\RegionInterfaceFactory')->create()->setRegionCode(self::ADDRESS_REGION_CODE2)->setRegion('Alabama')->setRegionId(1));
$customerAddress2->setStreet(['Black str, 48', 'Building D']);
$customerAddress2->setTelephone('3234676');
$customerAddress2->setCity(self::ADDRESS_CITY2);
$customerAddress2->setFirstname('John');
$customerAddress2->setLastname('Smith');
$address2 = $this->dataObjectProcessor->buildOutputDataArray($customerAddress2, 'Magento\\Customer\\Api\\Data\\AddressInterface');
$customerData = [CustomerData::FIRSTNAME => self::FIRSTNAME, CustomerData::LASTNAME => self::LASTNAME, CustomerData::EMAIL => 'janedoe' . uniqid() . '@example.com', CustomerData::CONFIRMATION => self::CONFIRMATION, CustomerData::CREATED_AT => self::CREATED_AT, CustomerData::CREATED_IN => self::STORE_NAME, CustomerData::DOB => self::DOB, CustomerData::GENDER => self::GENDER, CustomerData::GROUP_ID => self::GROUP_ID, CustomerData::MIDDLENAME => self::MIDDLENAME, CustomerData::PREFIX => self::PREFIX, CustomerData::STORE_ID => self::STORE_ID, CustomerData::SUFFIX => self::SUFFIX, CustomerData::TAXVAT => self::TAXVAT, CustomerData::WEBSITE_ID => self::WEBSITE_ID, CustomerData::KEY_ADDRESSES => [$address1, $address2], 'custom_attributes' => [['attribute_code' => 'disable_auto_group_change', 'value' => '0']]];
$customer = $this->customerDataFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
return $customer;
}
示例13: testUpdateCustomerException
public function testUpdateCustomerException()
{
$customerData = $this->_createCustomer();
$existingCustomerDataObject = $this->_getCustomerData($customerData[Customer::ID]);
$lastName = $existingCustomerDataObject->getLastname();
//Set non-existent id = -1
$customerData[Customer::LASTNAME] = $lastName . 'Updated';
$customerData[Customer::ID] = -1;
$newCustomerDataObject = $this->customerDataFactory->create();
$this->dataObjectHelper->populateWithArray($newCustomerDataObject, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$serviceInfo = ['rest' => ['resourcePath' => self::RESOURCE_PATH . "/-1", 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT], 'soap' => ['service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save']];
$newCustomerDataObject = $this->dataObjectProcessor->buildOutputDataArray($newCustomerDataObject, 'Magento\\Customer\\Api\\Data\\CustomerInterface');
$requestData = ['customer' => $newCustomerDataObject];
$expectedMessage = 'No such entity with %fieldName = %fieldValue';
try {
$this->_webApiCall($serviceInfo, $requestData);
$this->fail("Expected exception.");
} catch (\SoapFault $e) {
$this->assertContains($expectedMessage, $e->getMessage(), "SoapFault does not contain expected message.");
} catch (\Exception $e) {
$errorObj = $this->processRestExceptionResult($e);
$this->assertEquals($expectedMessage, $errorObj['message']);
$this->assertEquals(['fieldName' => 'customerId', 'fieldValue' => -1], $errorObj['parameters']);
$this->assertEquals(HTTPExceptionCodes::HTTP_NOT_FOUND, $e->getCode());
}
}
示例14: run
/**
* {@inheritdoc}
*/
public function run()
{
$this->logger->log('Installing customers:');
foreach ($this->fixtures as $file) {
/** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
$fileName = $this->fixtureHelper->getPath($file);
$csvReader = $this->csvReaderFactory->create(['fileName' => $fileName, 'mode' => 'r']);
foreach ($csvReader as $row) {
// Collect customer profile and addresses data
$customerData['profile'] = $this->convertRowData($row, $this->getDefaultCustomerProfile());
if (!$this->accountManagement->isEmailAvailable($customerData['profile']['email'])) {
continue;
}
$customerData['address'] = $this->convertRowData($row, $this->getDefaultCustomerAddress());
$customerData['address']['region_id'] = $this->getRegionId($customerData['address']);
$address = $customerData['address'];
$regionData = [RegionInterface::REGION_ID => $address['region_id'], RegionInterface::REGION => !empty($address['region']) ? $address['region'] : null, RegionInterface::REGION_CODE => !empty($address['region_code']) ? $address['region_code'] : null];
$region = $this->regionFactory->create();
$this->dataObjectHelper->populateWithArray($region, $regionData, '\\Magento\\Customer\\Api\\Data\\RegionInterface');
$addresses = $this->addressFactory->create();
unset($customerData['address']['region']);
$this->dataObjectHelper->populateWithArray($addresses, $customerData['address'], '\\Magento\\Customer\\Api\\Data\\AddressInterface');
$addresses->setRegion($region)->setIsDefaultBilling(true)->setIsDefaultShipping(true);
$customer = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $customerData['profile'], '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$customer->setAddresses([$addresses]);
$this->accountManagement->createAccount($customer, $row['password']);
$this->logger->logInline('.');
}
}
}
示例15: extract
/**
* @param string $formCode
* @param RequestInterface $request
* @return \Magento\Customer\Api\Data\CustomerInterface
*/
public function extract($formCode, RequestInterface $request)
{
$customerForm = $this->formFactory->create('customer', $formCode);
$customerData = $customerForm->extractData($request);
$allowedAttributes = $customerForm->getAllowedAttributes();
$isGroupIdEmpty = isset($allowedAttributes['group_id']);
$customerDataObject = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray($customerDataObject, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$store = $this->storeManager->getStore();
if ($isGroupIdEmpty) {
$customerDataObject->setGroupId($this->customerGroupManagement->getDefaultGroup($store->getId())->getId());
}
$customerDataObject->setWebsiteId($store->getWebsiteId());
$customerDataObject->setStoreId($store->getId());
return $customerDataObject;
}