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 1


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!.

  • How to do with IDE?
    – P S
    Dec 5, 2017 at 9:32
  • What IDE are you using?
    – Nero Phung
    Dec 5, 2017 at 9:35
  • Sublime Text 3.
    – P S
    Dec 5, 2017 at 9:51
  • It will be better to develop and debug with phpStorm mate.
    – Nero Phung
    Dec 5, 2017 at 9:53
  • Can I get a free version of it?
    – P S
    Dec 5, 2017 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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