Discovering how an FO controller works
As seen in the previous chapter, the best way to understand how things work is by studying a practical example. Why not continue our explanation with the reverse engineering of the content management system (CMS) front controller displaying the content of CMS pages or categories? Those pages can be used, for example, for legal notices or information pages.
This FO controller is called CmsControllerCore
and is defined in the /
controllers/front/CmsController.php
file.
The front controllers still rely on the legacy core because the migration to Symfony has not started yet for FO objects. That’s why routing is managed by Dispatcher
, which matches URL rewriting rules with FO controllers.
In our example, when a CMS page URL is called, the CmsControllerCore
class is instantiated. The first method to be called by Dispatcher
is run()
.
First, when browsing the /controllers/front/CmsController.php
file, we can see that the CmsControllerCore...