Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace VendorModulePlugin;
- use MagentoCustomerModelResourceModelCustomerRepository;
- use MagentoCustomerApiCustomerRepositoryInterface;
- use MagentoCustomerApiDataCustomerInterfaceFactory;
- use MagentoCustomerModelCustomerFactory;
- class CustomerAfterSave
- {
- protected $_customerDataFactory;
- protected $_customerRepositoryInterface;
- protected $_customerRepository;
- public function __construct(
- MagentoCustomerApiCustomerRepositoryInterface $customerRepositoryInterface,
- MagentoCustomerModelCustomerFactory $customerFactory,
- ) {
- $this->_customerRepositoryInterface = $customerRepositoryInterface;
- $this->_customerFactory = $customerFactory;
- }
- public function afterSave(CustomerRepository $subject,$savedCustomer)
- {
- //Get Customer
- $customerId = $savedCustomer->getId();
- $customer = $this->_customerRepositoryInterface->getById($customerId);
- $customer->setCustomAttribute('my_custom_attribute', 'test');
- $this->_customerRepositoryInterface->save($customer);
- exit;
- ( ! ) Fatal error: Maximum function nesting level of '256' reached, aborting! in /vendor/magento/module-customer/Model/ResourceModel/Address.php on line 58
Add Comment
Please, Sign In to add comment