Skip to content

Commit 8af73d8

Browse files
committed
GraphQL-388: updateCustomer mutation doesn't update undefined fields
1 parent 632937a commit 8af73d8

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
use Magento\Customer\Api\CustomerRepositoryInterface;
1111
use Magento\Framework\Exception\AlreadyExistsException;
1212
use Magento\Framework\Exception\LocalizedException;
13-
use Magento\Framework\Exception\NoSuchEntityException;
1413
use Magento\Framework\GraphQl\Exception\GraphQlAlreadyExistsException;
1514
use Magento\Framework\GraphQl\Exception\GraphQlAuthenticationException;
1615
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
17-
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
1816
use Magento\Store\Model\StoreManagerInterface;
1917
use Magento\Customer\Api\Data\CustomerInterface;
2018
use Magento\Framework\Api\DataObjectHelper;
@@ -78,18 +76,11 @@ public function __construct(
7876
* @return void
7977
* @throws GraphQlAlreadyExistsException
8078
* @throws GraphQlInputException
81-
* @throws GraphQlNoSuchEntityException
8279
* @throws GraphQlAuthenticationException
8380
*/
8481
public function execute(int $customerId, array $data): void
8582
{
86-
try {
87-
$customer = $this->customerRepository->getById($customerId);
88-
} catch (NoSuchEntityException $e) {
89-
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
90-
} catch (LocalizedException $e) {
91-
throw new GraphQlInputException(__($e->getMessage()), $e);
92-
}
83+
$customer = $this->customerRepository->getById($customerId);
9384

9485
$filteredData = array_diff_key($data, array_flip($this->restrictedKeys));
9586
$this->dataObjectHelper->populateWithArray($customer, $filteredData, CustomerInterface::class);

0 commit comments

Comments
 (0)