Skip to content

Commit 88a7eb2

Browse files
committed
Minor tweaks
1 parent 2d7393a commit 88a7eb2

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

doctrine.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,16 +695,16 @@ Automatic fetching works in these situations:
695695
on your entity (non-properties are ignored).
696696

697697
The ``{slug:product}`` syntax maps the route parameter named ``slug`` to the
698-
controller argument named ``$product``. It also hints the resolver to lookup
699-
by slug when loading the corresponding ``Product`` object from the database.
698+
controller argument named ``$product``. It also hints the resolver to look up
699+
the corresponding ``Product`` object from the database using the slug.
700700

701701
.. versionadded:: 7.1
702702

703703
Route parameter mapping was introduced in Symfony 7.1.
704704

705705
You can also configure the mapping explicitly for any controller argument
706-
with the ``MapEntity`` attribute. You can even control the
707-
``EntityValueResolver`` behavior by using the `MapEntity options`_ ::
706+
using the ``MapEntity`` attribute. You can even control the behavior of the
707+
``EntityValueResolver`` by using the `MapEntity options`_ ::
708708

709709
// src/Controller/ProductController.php
710710
namespace App\Controller;

routing.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,32 +1006,13 @@ using the request parameters (``slug`` in this case). If no object is found,
10061006
Symfony generates a 404 response automatically.
10071007

10081008
The ``{slug:post}`` syntax maps the route parameter named ``slug`` to the controller
1009-
argument named ``$post``. It also hints the "param converter" to lookup by slug
1010-
when loading the corresponding ``BlogPost`` object from the database.
1009+
argument named ``$post``. It also hints the "param converter" to look up the
1010+
corresponding ``BlogPost`` object from the database using the slug.
10111011

10121012
.. versionadded:: 7.1
10131013

10141014
Route parameter mapping was introduced in Symfony 7.1.
10151015

1016-
When more than one entity needs to be derived from route parameters, collisions can happen.
1017-
In the following example, the route tries to define two mappings: one to load an author by
1018-
name, two to load a category by name. But this is not allowed because from the side of the
1019-
route definition, this declares a parameter named "name" twice::
1020-
1021-
#[Route('/search-book/{name:author}/{name:category}')]
1022-
1023-
Such routes should instead be defined using the following syntax::
1024-
1025-
#[Route('/search-book/{authorName:author.name}/{categoryName:category.name}')]
1026-
1027-
This way, the route parameter names are unique (``authorName`` and ``categoryName``) and
1028-
the "param converter" can correctly map them to controller arguments (``$author`` and
1029-
``$category``), loading them both by their name.
1030-
1031-
.. versionadded:: 7.3
1032-
1033-
This more advanced style of route parameter mapping was introduced in Symfony 7.3.
1034-
10351016
More advanced mappings can be achieved using the ``#[MapEntity]`` attribute.
10361017
Check out the :ref:`Doctrine param conversion documentation <doctrine-entity-value-resolver>`
10371018
to learn how to customize the database queries used to fetch the object from the route

0 commit comments

Comments
 (0)