Skip to content

Commit b18bdf3

Browse files
author
Jon Doe
committed
ACP2E-203: Issues with admin actions report logging
1 parent 6cf7fe0 commit b18bdf3

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
219219
$customer->setAddresses($origAddresses);
220220
/** @var CustomerModel $customerModel */
221221
$customerModel = $this->customerFactory->create(['data' => $customerData]);
222-
if (!empty($prevCustomerDataArr)) {
223-
foreach ($prevCustomerDataArr as $field => $value) {
224-
$customerModel->setOrigData($field, $value);
225-
}
226-
}
222+
$this->populateWithOrigData($customerModel, $prevCustomerDataArr);
227223

228224
//Model's actual ID field maybe different than "id" so "id" field from $customerData may be ignored.
229225
$customerModel->setId($customer->getId());
@@ -301,6 +297,19 @@ public function save(CustomerInterface $customer, $passwordHash = null)
301297
return $savedCustomer;
302298
}
303299

300+
/**
301+
* @param CustomerModel $customerModel
302+
* @param array $prevCustomerDataArr
303+
*/
304+
private function populateWithOrigData(CustomerModel $customerModel, array $prevCustomerDataArr)
305+
{
306+
if (!empty($prevCustomerDataArr)) {
307+
foreach ($prevCustomerDataArr as $field => $value) {
308+
$customerModel->setOrigData($field, $value);
309+
}
310+
}
311+
}
312+
304313
/**
305314
* Delete addresses by ids
306315
*

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ public function testGetList(): void
694694
}
695695

696696
/**
697-
* @return void
697+
* @return void
698698
*/
699699
public function testDeleteById(): void
700700
{
@@ -715,8 +715,8 @@ public function testDeleteById(): void
715715
}
716716

717717
/**
718-
* @return void
719-
*/
718+
* @return void
719+
*/
720720
public function testDelete(): void
721721
{
722722
$customerId = 14;

0 commit comments

Comments
 (0)