File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1545,15 +1545,19 @@ information in a controller via the ``Request`` object::
15451545You can get this information in services too injecting the ``request_stack ``
15461546service to :doc: `get the Request object in a service </service_container/request >`.
15471547In templates, use the :ref: `Twig global app variable <twig-app-variable >` to get
1548- the request and its attributes:
1548+ the current route and its attributes:
15491549
15501550.. code-block :: twig
15511551
1552- {% set route_name = app.request.attributes.get('_route') %}
1553- {% set route_parameters = app.request.attributes.get('_route_params') %}
1552+ {% set route_name = app.current_route %}
1553+ {% set route_parameters = app.current_route_parameters %}
15541554
1555- {# use this to get all the available attributes (not only routing ones) #}
1556- {% set all_attributes = app.request.attributes.all %}
1555+ .. versionadded :: 6.2
1556+
1557+ The ``app.current_route `` and ``app.current_route_parameters `` variables
1558+ were introduced in Symfony 6.2.
1559+ Before you had to access ``_route `` and ``_route_params `` request
1560+ attributes using ``app.request.attributes.get() ``.
15571561
15581562Special Routes
15591563--------------
You can’t perform that action at this time.
0 commit comments