See the events.xsd
.
An event’s declaration:
https://github.com/magento/magento2/blob/2335247d4ae2dc1e0728ee73022b0a244ccd7f4c/lib/internal/Magento/Framework/Event/etc/events.xsd#L36-L46
An observers’s subdeclaration:
https://github.com/magento/magento2/blob/2335247d4ae2dc1e0728ee73022b0a244ccd7f4c/lib/internal/Magento/Framework/Event/etc/events.xsd#L48-L58
Why is it wrong?
For example, look at the catalog_block_product_status_display
event:
So, an observer can set display_status
to true
or false
, for example:
https://github.com/magento/magento2/blob/2335247d4ae2dc1e0728ee73022b0a244ccd7f4c/app/code/Magento/CatalogInventory/Observer/DisplayProductStatusInfoObserver.php#L37-L41
If there are mutiple observers for the catalog_block_product_status_display
event then the Magento 2 behavior becomes unpredictable because we can not set observer’s ordering.