resourceModel = $resourceModel; } /** * @param \Magento\Customer\Api\CustomerRepositoryInterface $subject * @param callable $proceed * @param \Magento\Customer\Api\Data\CustomerInterface $customer * @param string $passwordHash * @return \Magento\Customer\Api\Data\CustomerInterface * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundSave( \Magento\Customer\Api\CustomerRepositoryInterface $subject, \Closure $proceed, \Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null ) { $this->resourceModel->beginTransaction(); try { /** @var $result \Magento\Customer\Api\Data\CustomerInterface */ $result = $proceed($customer, $passwordHash); $this->resourceModel->commit(); return $result; } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; } } }