I am new to symfony2. I started it with some tutorials and then started building SYMBLOG. I have understood it and i am able to add or change the functionality. I have a bit confusion in the workflow, I mean How the files work together to render a page or to produce an output. Can anyone explain me in detail from the beginning how this flow goes on in symfony2. starting from the user request say user enters a url till the symfony2 displays results. please include the routing.yml in the flow. ?
Share
You should check out this link. Symfony – the big picture
It explains in detail all the steps involved from the time you enter the URL in the browser to the page getting rendered.
Basically all requests go to a Front Controller. Its job is to route the requests to the appropriate controller code. It does this with the help of the routes defined in the
app/config/routing.ymlfile. The controllers which are defined insrc/<BundleName>/Controller/<name>perform some business logic, like getting data from the Model (Repository) and send that information to the View (Templates). The views are simply HTML code. Symfony uses a templating engine called Twig. Instead of including<?php ... ?>blocks in the HTML code, Symfony passes the data from the controller and it can be easily used inside the view within Twig{% %}or{{ }}blocks.Simply put, here is the workflow:
There are things like the app/AppKernel that come in between but I have skipped it.
Here are the useful excerpts from the link provided above:
URL:
Routing:
Controller:
View:
You may also want to check out the Symfony2 architecture