I have this event that fires just fine:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="customer_save_after"> <observer name="remago_addcustomertotree" instance="Remago\Customertree\Observer\Addcustomertotree" /> </event> </config>
What I am trying to do is get the customer ID so that it can be added in a different table, when I create it in backend.
This is how I do it:
$customer = $observer->getEvent()->getCustomer();
Now, I am able to get all of his/her data by using
and everything looks ok.
The problem is I can't seem to get anything other than null when I use:
Initially, I thought the problem was that I was using the event
But changing it to
had no effects whatsoever.