Skip to content

Commit 43325d0

Browse files
committed
minor #17999 [Routing] Mention that param converters are now native (javiereguiluz)
This PR was merged into the 6.2 branch. Discussion ---------- [Routing] Mention that param converters are now native Replaces #17518 Commits ------- aafff28 [Routing[ Mention that param converters are now native
2 parents 2ab1ea4 + aafff28 commit 43325d0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

routing.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -949,11 +949,11 @@ A common routing need is to convert the value stored in some parameter (e.g. an
949949
integer acting as the user ID) into another value (e.g. the object that
950950
represents the user). This feature is called a "param converter".
951951

952-
To add support for "param converters" we need SensioFrameworkExtraBundle:
953-
954-
.. code-block:: terminal
952+
.. versionadded:: 6.2
955953

956-
$ composer require sensio/framework-extra-bundle
954+
Starting from Symfony 6.2, route param conversion is a built-in feature.
955+
In previous Symfony versions you had to install the package
956+
``sensio/framework-extra-bundle`` before using this feature.
957957

958958
Now, keep the previous route configuration, but change the arguments of the
959959
controller action. Instead of ``string $slug``, add ``BlogPost $post``::
@@ -984,8 +984,9 @@ this case), the "param converter" makes a database request to find the object
984984
using the request parameters (``slug`` in this case). If no object is found,
985985
Symfony generates a 404 response automatically.
986986

987-
Read the `full param converter documentation`_ to learn about the converters
988-
provided by Symfony and how to configure them.
987+
Check out the `Doctrine param conversion documentation <doctrine-entity-value-resolver>`_
988+
to learn about the ``#[MapEntity]`` attribute that can be used to customize the
989+
database queries used to fetch the object from the route parameter.
989990

990991
Special Parameters
991992
~~~~~~~~~~~~~~~~~~
@@ -2672,5 +2673,4 @@ Learn more about Routing
26722673

26732674
.. _`PHP regular expressions`: https://www.php.net/manual/en/book.pcre.php
26742675
.. _`PCRE Unicode properties`: https://www.php.net/manual/en/regexp.reference.unicode.php
2675-
.. _`full param converter documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
26762676
.. _`FOSJsRoutingBundle`: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle

0 commit comments

Comments
 (0)