0

I am working on Admin Actions Log Extension. For the reference i am using the link below

https://amasty.com/admin-actions-log-for-magento-2.html

I want to get old and new data of customers when we save the customer.

EDIT:-

I'm using these events model_save_before and model_save_after for saving old data to the registry and retrieve it to the save after event, but I'm getting old data as null from the registry.

SaveBefore.php

$object = $observer->getObject();
$customer = $this->objectManager->get('Magento\Customer\Model\Backend\Customer')->load($object->getId());
$customerData = $customer->getData();
$this->registryManager->register('adminactionslog_savebefore_data', $customerData, true);

SaveAfter.php

$oldData = $this->registryManager->registry('adminactionslog_savebefore_data');
// var_dump($oldData); I'm getting this value as null

if anyone has a solution please let me know.

1

There is a problem with this particular event

Magento 2 origData null in customer_save_before

You are going to have to use a different event or code a workaround.

1
  • do you have any suggestions?
    – Mohit Rane
    Aug 8 '19 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.