Skip to content

Commit ef297ab

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Tweak and added some example [Routing] Document _query parameter for URL generation
2 parents 6152846 + 1cf7956 commit ef297ab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

routing.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,18 @@ special parameters created by Symfony:
11461146
``_locale``
11471147
Used to set the :ref:`locale <translation-locale-url>` on the request.
11481148

1149+
``_query``
1150+
Used to add query parameters to the generated URL.
1151+
1152+
.. versionadded:: 7.4
1153+
1154+
The ``_query`` parameter was introduced in Symfony 7.4.
1155+
1156+
.. deprecated:: 7.4
1157+
1158+
Passing a value other than an array as the ``_query`` parameter was
1159+
deprecated in Symfony 7.4.
1160+
11491161
You can include these attributes (except ``_fragment``) both in individual routes
11501162
and in route imports. Symfony defines some special attributes with the same name
11511163
(except for the leading underscore) so you can define them easier:
@@ -1164,6 +1176,7 @@ and in route imports. Symfony defines some special attributes with the same name
11641176
path: '/articles/{_locale}/search.{_format}',
11651177
locale: 'en',
11661178
format: 'html',
1179+
query: ['page' => 1],
11671180
requirements: [
11681181
'_locale' => 'en|fr',
11691182
'_format' => 'html|xml',
@@ -1182,6 +1195,8 @@ and in route imports. Symfony defines some special attributes with the same name
11821195
controller: App\Controller\ArticleController::search
11831196
locale: en
11841197
format: html
1198+
query:
1199+
page: 1
11851200
requirements:
11861201
_locale: en|fr
11871202
_format: html|xml
@@ -1219,6 +1234,7 @@ and in route imports. Symfony defines some special attributes with the same name
12191234
->controller([ArticleController::class, 'search'])
12201235
->locale('en')
12211236
->format('html')
1237+
->query(['page' => 1])
12221238
->requirements([
12231239
'_locale' => 'en|fr',
12241240
'_format' => 'html|xml',

0 commit comments

Comments
 (0)