Skip to content

Commit 5877d02

Browse files
Farkieweaverryan
authored andcommitted
Update http_cache.rst
Explained how the parameters are passed to the controller - named parameters
1 parent 925a162 commit 5877d02

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

book/http_cache.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,19 @@ wondering why you would want to use a helper instead of just writing the ESI
938938
tag yourself. That's because using a helper makes your application work even
939939
if there is no gateway cache installed.
940940

941+
.. tip::
942+
943+
Using render_esi with parameters doesn't use request variables - they are
944+
passed in as named parameters. They must be named the same.
945+
946+
e.g. ``render_esi(controller('...:content', { max_per_page: 5, type: 'news' }``
947+
948+
.. code-block:: php
949+
950+
public function content($max_per_page = 10, $type = "news")
951+
{
952+
953+
941954
When using the default ``render`` function (or setting the renderer to
942955
``inline``), Symfony merges the included page content into the main one
943956
before sending the response to the client. But if you use the ``esi`` renderer

0 commit comments

Comments
 (0)