Skip to content

Commit 8f9ab11

Browse files
committed
MAGETWO-61907: [Backport] - Updating customer via REST API without address unsets default billing and default shipping address - for 2.1
1 parent 5db3632 commit 8f9ab11

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
/**
1616
* Customer repository.
17+
*
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
*/
1920
class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInterface
@@ -330,11 +331,11 @@ protected function addFilterGroupToCollection(
330331
* Update customer addresses.
331332
*
332333
* @param \Magento\Framework\Api\CustomAttributesDataInterface $customer
333-
* @param $customerId
334+
* @param int $customerId
334335
* @return void
335336
* @throws \Magento\Framework\Exception\InputException
336337
*/
337-
private function updateAddresses(\Magento\Framework\Api\CustomAttributesDataInterface $customer, $customerId)
338+
private function updateAddresses(\Magento\Framework\Api\CustomAttributesDataInterface $customer, int $customerId)
338339
{
339340
if ($customer->getAddresses() !== null) {
340341
if ($customer->getId()) {
@@ -368,8 +369,9 @@ private function updateAddresses(\Magento\Framework\Api\CustomAttributesDataInte
368369
* Populate customer model with secure data.
369370
*
370371
* @param \Magento\Framework\Api\CustomAttributesDataInterface $customer
371-
* @param $passwordHash
372-
* @param $customerModel
372+
* @param string $passwordHash
373+
* @param \Magento\Customer\Model\Customer\Interceptor $customerModel
374+
* @return void
373375
*/
374376
private function populateCustomerModelWithSecureData(
375377
\Magento\Framework\Api\CustomAttributesDataInterface $customer,
@@ -394,12 +396,16 @@ private function populateCustomerModelWithSecureData(
394396
/**
395397
* Set default billing.
396398
*
397-
* @param $customerArr
398-
* @param $prevCustomerDataArr
399-
* @param $customerModel
399+
* @param array $customerArr
400+
* @param array $prevCustomerDataArr
401+
* @param \Magento\Customer\Model\Customer\Interceptor $customerModel
402+
* @return void
400403
*/
401-
private function setDefaultBilling($customerArr, $prevCustomerDataArr, $customerModel)
402-
{
404+
private function setDefaultBilling(
405+
$customerArr,
406+
$prevCustomerDataArr,
407+
$customerModel
408+
) {
403409
if (!array_key_exists('default_billing', $customerArr) &&
404410
null !== $prevCustomerDataArr &&
405411
array_key_exists('default_billing', $prevCustomerDataArr)
@@ -411,12 +417,16 @@ private function setDefaultBilling($customerArr, $prevCustomerDataArr, $customer
411417
/**
412418
* Set default shipping.
413419
*
414-
* @param $customerArr
415-
* @param $prevCustomerDataArr
416-
* @param $customerModel
420+
* @param array $customerArr
421+
* @param array $prevCustomerDataArr
422+
* @param \Magento\Customer\Model\Customer\Interceptor $customerModel
423+
* @return void
417424
*/
418-
private function setDefaultShipping($customerArr, $prevCustomerDataArr, $customerModel)
419-
{
425+
private function setDefaultShipping(
426+
$customerArr,
427+
$prevCustomerDataArr,
428+
$customerModel
429+
) {
420430
if (!array_key_exists('default_shipping', $customerArr) &&
421431
null !== $prevCustomerDataArr &&
422432
array_key_exists('default_shipping', $prevCustomerDataArr)

0 commit comments

Comments
 (0)