Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between MASTER / SUB REQUEST in Symfony2?

Tags:

symfony

so im reading the internals documentation for symfony2 http://symfony.com/doc/current/book/internals.html and i dont understand this section http://symfony.com/doc/current/book/internals.html#events.

so, i want to know the difference between MASTER / SUB REQUEST ?

like image 965
Lhassan Baazzi Avatar asked Sep 17 '12 09:09

Lhassan Baazzi


2 Answers

The master request is the one that comes from the original user; the subrequest is the one that you do internally — either with the forward() method of HttpKernel — or by the forward() helper of the framework's Controller class — or {% render ... %} in Twig.

like image 135
Elnur Abdurrakhimov Avatar answered Oct 23 '22 13:10

Elnur Abdurrakhimov


The master request is the one, that is triggered by the browser and the sub requests are requests from within the application. For example a template can render another action

<div id="sidebar">
    {% render "AcmeArticleBundle:Article:recentArticles" with {'max': 3} %}
</div>

(Example taken from the manual)

This will lead to a sub request.

like image 22
KingCrunch Avatar answered Oct 23 '22 13:10

KingCrunch