The definitive guide of Symfony 1.2

Chapter 6. Inside The Controller Layer

In symfony, the controller layer, which contains the code linking the business logic and the presentation, is split into several components that you use for different purposes:

  • The front controller is the unique entry point to the application. It loads the configuration and determines the action to execute.
  • Actions contain the applicative logic. They check the integrity of the request and prepare the data needed by the presentation layer.
  • The request, response, and session objects give access to the request parameters, the response headers, and the persistent user data. They are used very often in the controller layer.
  • Filters are portions of code executed for every request, before or after the action. For example, the security and validation filters are commonly used in web applications. You can extend the framework by creating your own filters.

This chapter describes all these components, but don't be intimidated by their number. For a basic page, you will probably need to write only a few lines in the action class, and that's all. The other controller components will be of use only in specific situations.