Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a02f175

Browse files
[Routing] Improving language, shortening twig code
Page: https://symfony.com/doc/6.3/routing.html#getting-the-route-name-and-parameters * The first sentence wasn't english. * Defining a Twig variable for this is quite useless nowadays - this looks like a leftover from previous versions where the syntax was lengthy: https://symfony.com/doc/5.4/routing.html#getting-the-route-name-and-parameters
1 parent 94ce872 commit a02f175

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

routing.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,15 +1603,14 @@ information in a controller via the ``Request`` object::
16031603
}
16041604
}
16051605

1606-
You can get this information in services too injecting the ``request_stack``
1607-
service to :doc:`get the Request object in a service </service_container/request>`.
1608-
In templates, use the :ref:`Twig global app variable <twig-app-variable>` to get
1606+
To get this information in a service, see :doc:`/service_container/request`.
1607+
In templates, you can use the :ref:`Twig global app variable <twig-app-variable>` to get
16091608
the current route and its attributes:
16101609

16111610
.. code-block:: twig
16121611
1613-
{% set route_name = app.current_route %}
1614-
{% set route_parameters = app.current_route_parameters %}
1612+
{% app.current_route %}
1613+
{% app.current_route_parameters %}
16151614
16161615
.. versionadded:: 6.2
16171616

0 commit comments

Comments
 (0)