daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Dec 18th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. namespace VendorModulePlugin;
  3.  
  4. use MagentoCustomerModelResourceModelCustomerRepository;
  5. use MagentoCustomerApiCustomerRepositoryInterface;
  6. use MagentoCustomerApiDataCustomerInterfaceFactory;
  7. use MagentoCustomerModelCustomerFactory;
  8.  
  9.  
  10. class CustomerAfterSave
  11. {
  12.     protected $_customerDataFactory;
  13.     protected $_customerRepositoryInterface;
  14.     protected $_customerRepository;
  15.  
  16.     public function __construct(
  17.         MagentoCustomerApiCustomerRepositoryInterface $customerRepositoryInterface,
  18.         MagentoCustomerModelCustomerFactory $customerFactory,
  19.     ) {
  20.  
  21.         $this->_customerRepositoryInterface = $customerRepositoryInterface;
  22.         $this->_customerFactory = $customerFactory;
  23.     }
  24.  
  25.     public function afterSave(CustomerRepository $subject,$savedCustomer)
  26.     {
  27.         //Get Customer
  28.         $customerId = $savedCustomer->getId();
  29.  
  30.         $customer = $this->_customerRepositoryInterface->getById($customerId);
  31.         $customer->setCustomAttribute('my_custom_attribute', 'test');
  32.         $this->_customerRepositoryInterface->save($customer);
  33.         exit;
  34.    
  35. ( ! ) Fatal error: Maximum function nesting level of '256' reached, aborting! in /vendor/magento/module-customer/Model/ResourceModel/Address.php on line 58
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top