File tree 1 file changed +9
-5
lines changed
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::
1545
1545
You can get this information in services too injecting the ``request_stack ``
1546
1546
service to :doc: `get the Request object in a service </service_container/request >`.
1547
1547
In 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:
1549
1549
1550
1550
.. code-block :: twig
1551
1551
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 %}
1554
1554
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() ``.
1557
1561
1558
1562
Special Routes
1559
1563
--------------
You can’t perform that action at this time.
0 commit comments