Events

← Events

Ashterix

docs(articles): Magento and Symfony examples side by side, request lifecycle as a Mermaid diagram

en/articles/magento-to-symfony/core/events.md +6 −1

1 1 # Events
2 2
3 + ::::columns
4 + :::col
3 5 **Magento** · events.xml + Observer
4 6
5 7 ```xml
23 25 ['order' => $order]
24 26 );
25 27 ```
26 −
28 + :::
29 + :::col
27 30 **Symfony** · event class + listener
28 31
29 32 ```php
45 48
46 49 $this->dispatcher->dispatch(new OrderPlaced($order->getId()));
47 50 ```
51 + :::
52 + ::::
48 53
49 54 - An event is a typed class, and the event name is its FQCN. No string keys in an array.
50 55 - There is a priority: `#[AsEventListener(priority: 10)]`, higher runs earlier. In Magento the order of observers is not guaranteed.