Skip to content

[Routing] Document _query parameter for URL generation #21119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,17 @@ special parameters created by Symfony:
This is used for such things as setting the ``Content-Type`` of the response
(e.g. a ``json`` format translates into a ``Content-Type`` of ``application/json``).

``_query``
Used to add query parameters to the generated URL.

.. versionadded:: 7.4

The ``_query`` parameter was introduced in Symfony 7.4.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps adds that its an array ?
Or give an example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other parameters are documented with the same level of detail, thus I wanted to keep it consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it, also down below there is example for _locale and _format which are "dev oriented" variables
the _controller and _fragment are more "internal oriented"

this new param _query seems more the first to me, for devs so I really think giving a small example can be valuable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait for some of the maintainers to comment on this, to avoid adding the example and then later on it requesting to be removed. (_fragment is also for "external" use to set the URL hash.)


.. deprecated:: 7.4

Passing a value other than an array as the ``_query`` parameter was deprecated in Symfony 7.4.

``_fragment``
Used to set the fragment identifier, which is the optional last part of a URL that
starts with a ``#`` character and is used to identify a portion of a document.
Expand Down