I am quite unsure of how to know which event will occur when. I cannot understand what arguments I should capture in observer unless I find exactly what I want in internet.
1 Answer
In Magento 2, some observers will be dispatched in core code like this:
$this->_eventManager->dispatch('catalog_product_collection_load_after', ['collection' => $this]);
As you see, you can get argument by call $observer->getEvent()->getColelction();
Also, some observers will not. In this situation, you have to use some IDE support debug to get what the event dispatch!.
-
-
-
-
It will be better to develop and debug with phpStorm mate. Commented Dec 5, 2017 at 9:53
-