docs(articles): Magento and Symfony examples side by side, request lifecycle as a Mermaid diagram
en/articles/magento-to-symfony/basics/lifecycle.md
+15
ā12
2
2
3
3
In Magento a request goes through the FrontController, the router list and the action's `execute()`. In Symfony `HttpKernel` follows the same path, but every step is an event anyone can subscribe to: routing, security, argument conversion, exception handling. Understand this diagram, and most of Symfony's "magic" becomes ordinary event listeners.
4
4
5
ā
```text
6
ā
public/index.php
7
ā
ā Kernel::handle(Request)
8
ā
ā kernel.request RouterListener finds the route, then Firewall: who the user is
9
ā
ā kernel.controller
10
ā
ā ArgumentResolver Request, entities, DTOs
11
ā
ā Controller
12
ā
returned a Response ā kernel.response
13
ā
returned a non-Response ā kernel.view ā kernel.response
14
ā
threw an exception ā kernel.exception ā kernel.response
15
ā
ā Response::send()
16
ā
ā kernel.terminate
5
+
```mermaid
6
+
flowchart TD
7
+
A["public/index.php"] --> B["Kernel::handle(Request)"]
8
+
B --> C{{"kernel.request"}}
9
+
C -->|"RouterListener finds the route"| C2["Firewall: who the user is"]
10
+
C2 --> D{{"kernel.controller"}}
11
+
D --> E["ArgumentResolver: Request, entities, DTOs"]
12
+
E --> F["Controller"]
13
+
F -->|"returned a Response"| H{{"kernel.response"}}
14
+
F -->|"returned something else"| G{{"kernel.view"}}
15
+
G --> H
16
+
H --> I["Response::send()"]
17
+
I --> J{{"kernel.terminate"}}
18
+
F -. "exception" .-> X{{"kernel.exception"}}
19
+
X --> H
17
20
```
18
21
19
22
| Symfony step | Closest in Magento | What happens there |