Skip to content

Commit 4de3337

Browse files
committed
GraphQL-458: CustomerGraphQl module refactoring
1 parent 7a947fc commit 4de3337

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function execute(CustomerInterface $customer): array
102102
}
103103
$customerData = array_merge($customerData, $customAttributes);
104104

105+
$customerData['model'] = $customer;
105106
return $customerData;
106107
}
107108
}

app/code/Magento/CustomerGraphQl/Model/Resolver/ChangePassword.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\CustomerGraphQl\Model\Customer\CheckCustomerPassword;
1212
use Magento\CustomerGraphQl\Model\Customer\ExtractCustomerData;
1313
use Magento\CustomerGraphQl\Model\Customer\GetCustomer;
14+
use Magento\Framework\Exception\LocalizedException;
1415
use Magento\Framework\GraphQl\Config\Element\Field;
1516
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1617
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -81,8 +82,12 @@ public function resolve(
8182
$customerId = (int)$customer->getId();
8283

8384
$this->checkCustomerPassword->execute($args['currentPassword'], $customerId);
84-
$this->accountManagement->changePasswordById($customerId, $args['currentPassword'], $args['newPassword']);
8585

86+
try {
87+
$this->accountManagement->changePasswordById($customerId, $args['currentPassword'], $args['newPassword']);
88+
} catch (LocalizedException $e) {
89+
throw new GraphQlInputException(__($e->getMessage()), $e);
90+
}
8691
return $this->extractCustomerData->execute($customer);
8792
}
8893
}

0 commit comments

Comments
 (0)