cancel
Showing results for 
Search instead for 
Did you mean: 

M2.3 - origData is null in customer_save_before

M2.3 - origData is null in customer_save_before

I have created an observer on the customer_save_before event. Surprisingly $observer->getEvent()->getCustomer()->getOrigData() is null. Is my expectation wrong?

This is also happening for customer_save_commit_after.

 

I am looking for an event for which the customer data (new and original) is available, that ideally takes place after the new data was persisted in the db, independent of the area from which it is called frontend or adminhtml.

 

I have logged all the events that are being dispatched throughout my save customer process and the two events mentioned above made the most sense.

 

In conclusion, I have two questions:

Is there such an event?

Why is origData null on the $observer->getEvent()->getCustomer() object when the event observer triggers?

 

P.S. I found two issues reported on Magento Community Github:

https://github.com/magento/magento2/issues/4662

https://github.com/magento/magento2/issues/8788

that unfortunately were closed without a clear resolution.

 

Thanks!