File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel
220
220
private $ accountConfirmation ;
221
221
222
222
/**
223
- * Caching property to store customer addresses by the customer ID.
223
+ * Caching property to store customer address data models by the address ID.
224
224
*
225
225
* @var array
226
226
*/
@@ -319,14 +319,12 @@ public function getDataModel()
319
319
{
320
320
$ customerData = $ this ->getData ();
321
321
$ addressesData = [];
322
- if ( isset ( $ customerData [ ' entity_id ' ]) && ! isset ( $ this -> storedAddress [ $ customerData [ ' entity_id ' ]])) {
323
- /** @var \Magento\Customer\Model\Address $address */
324
- foreach ( $ this ->getAddresses () as $ address ) {
325
- $ addressesData [ ] = $ address ->getDataModel ();
322
+ /** @var \Magento\Customer\Model\Address $address */
323
+ foreach ( $ this -> getAddresses () as $ address) {
324
+ if (! isset ( $ this ->storedAddress [ $ address-> getId ()]) ) {
325
+ $ this -> storedAddress [ $ address -> getId () ] = $ address ->getDataModel ();
326
326
}
327
- $ this ->storedAddress [$ customerData ['entity_id ' ]] = $ addressesData ;
328
- } elseif (isset ($ customerData ['entity_id ' ], $ this ->storedAddress [$ customerData ['entity_id ' ]])) {
329
- $ addressesData = $ this ->storedAddress [$ customerData ['entity_id ' ]];
327
+ $ addressesData [] = $ this ->storedAddress [$ address ->getId ()];
330
328
}
331
329
$ customerDataObject = $ this ->customerDataFactory ->create ();
332
330
$ this ->dataObjectHelper ->populateWithArray (
Original file line number Diff line number Diff line change 18
18
19
19
/**
20
20
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21
+ * @SuppressWarnings(PHPMD.TooManyFields)
21
22
*/
22
23
class CustomerTest extends \PHPUnit \Framework \TestCase
23
24
{
You can’t perform that action at this time.
0 commit comments