filmov
tv
Beginners Guide to Symfony 2.7 Routing and Controllers
Показать описание
In this video we take a look at how we can use Controllers and Routing inside a Symfony2.7 application to direct traffic around based on what URI the site user is requesting, and then 'control' what that user ultimately can see or do once the page renders.
You may have heard of the MVC / Model View Controller software architectural pattern and found yourself left with more questions than answers.
A Controller is a somewhat confusing term - the first time I heard of it I was left wondering what is being controlled, and why?
A Controller is an apparently relatively straightforward concept. It controls things.
We have discussed in the previous video how Symfony is primarily concerned with handling Requests, and returning Responses.
A controller takes Requests, does something with them, and then returns a Response. That is the job of the controller in a nutshell.
The something it does is specific to your application. If you need to register a new User, that's the something. If you need to delete a record from the database, that's the something.
Remember - a Controller is concerned with taking our Request and generating some sort of Response.
A Controller must always return a Response.
Комментарии