Skip to content

Commit d73f510

Browse files
committed
MAGETWO-97411: \Magento\Customer\Model\Customer::getDataModel method takes to much time to load with many addresses customer
1 parent ca7aa05 commit d73f510

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/code/Magento/Customer/Model/Customer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,23 @@ public function _construct()
318318
public function getDataModel()
319319
{
320320
$customerData = $this->getData();
321+
$addressesData = [];
321322
if (isset($customerData['entity_id']) && !isset($this->storedAddress[$customerData['entity_id']])) {
322-
$addressesData = [];
323323
/** @var \Magento\Customer\Model\Address $address */
324324
foreach ($this->getAddresses() as $address) {
325325
$addressesData[] = $address->getDataModel();
326326
}
327327
$this->storedAddress[$customerData['entity_id']] = $addressesData;
328328
} elseif (isset($customerData['entity_id'], $this->storedAddress[$customerData['entity_id']])) {
329-
$customerData = $this->storedAddress[$customerData['entity_id']];
329+
$addressesData = $this->storedAddress[$customerData['entity_id']];
330330
}
331331
$customerDataObject = $this->customerDataFactory->create();
332332
$this->dataObjectHelper->populateWithArray(
333333
$customerDataObject,
334334
$customerData,
335335
\Magento\Customer\Api\Data\CustomerInterface::class
336336
);
337-
$customerDataObject->setAddresses($customerData)
337+
$customerDataObject->setAddresses($addressesData)
338338
->setId($this->getId());
339339
return $customerDataObject;
340340
}

0 commit comments

Comments
 (0)