Skip to content

Commit 1cf7956

Browse files
committed
Tweak and added some example
1 parent 505619f commit 1cf7956

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

routing.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,13 @@ special parameters created by Symfony:
11511151
This is used for such things as setting the ``Content-Type`` of the response
11521152
(e.g. a ``json`` format translates into a ``Content-Type`` of ``application/json``).
11531153

1154+
``_fragment``
1155+
Used to set the fragment identifier, which is the optional last part of a URL that
1156+
starts with a ``#`` character and is used to identify a portion of a document.
1157+
1158+
``_locale``
1159+
Used to set the :ref:`locale <translation-locale-url>` on the request.
1160+
11541161
``_query``
11551162
Used to add query parameters to the generated URL.
11561163

@@ -1160,14 +1167,8 @@ special parameters created by Symfony:
11601167

11611168
.. deprecated:: 7.4
11621169

1163-
Passing a value other than an array as the ``_query`` parameter was deprecated in Symfony 7.4.
1164-
1165-
``_fragment``
1166-
Used to set the fragment identifier, which is the optional last part of a URL that
1167-
starts with a ``#`` character and is used to identify a portion of a document.
1168-
1169-
``_locale``
1170-
Used to set the :ref:`locale <translation-locale-url>` on the request.
1170+
Passing a value other than an array as the ``_query`` parameter was
1171+
deprecated in Symfony 7.4.
11711172

11721173
You can include these attributes (except ``_fragment``) both in individual routes
11731174
and in route imports. Symfony defines some special attributes with the same name
@@ -1187,6 +1188,7 @@ and in route imports. Symfony defines some special attributes with the same name
11871188
path: '/articles/{_locale}/search.{_format}',
11881189
locale: 'en',
11891190
format: 'html',
1191+
query: ['page' => 1],
11901192
requirements: [
11911193
'_locale' => 'en|fr',
11921194
'_format' => 'html|xml',
@@ -1205,6 +1207,8 @@ and in route imports. Symfony defines some special attributes with the same name
12051207
controller: App\Controller\ArticleController::search
12061208
locale: en
12071209
format: html
1210+
query:
1211+
page: 1
12081212
requirements:
12091213
_locale: en|fr
12101214
_format: html|xml
@@ -1242,6 +1246,7 @@ and in route imports. Symfony defines some special attributes with the same name
12421246
->controller([ArticleController::class, 'search'])
12431247
->locale('en')
12441248
->format('html')
1249+
->query(['page' => 1])
12451250
->requirements([
12461251
'_locale' => 'en|fr',
12471252
'_format' => 'html|xml',

0 commit comments

Comments
 (0)