Skip to content

Commit e3d16d7

Browse files
committed
Reword
1 parent 80daec3 commit e3d16d7

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

doctrine.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -685,16 +685,14 @@ Automatic fetching works in these situations:
685685
*all* of the wildcards in your route that are actually properties
686686
on your entity (non-properties are ignored).
687687

688-
This behavior is enabled by default on all your controllers.
688+
This behavior is enabled by default on all controllers. If you prefer, you can
689+
restrict this feature to only work on route wildcards called ``id`` to look for
690+
entities by primary key. To do so, set the option
691+
``doctrine.orm.controller_resolver.auto_mapping`` to ``false``.
689692

690-
You can only allow the use of the primary key ``id`` as a lookup placeholder
691-
for the routes parameters by setting ``doctrine.orm.controller_resolver.auto_mapping``
692-
config option to ``false``. The others entity attributes than ``id`` can't be used
693-
to autowire the entity.
694-
695-
When disabled, you can enable the entity autowiring individually on the desired controllers
696-
by using the ``MapEntity`` attribute. You can control ``EntityValueResolver`` behavior
697-
with it by using the `MapEntity options`_ ::
693+
When ``auto_mapping`` is disabled, you can configure the mapping explicitly for
694+
any controller argument with the ``MapEntity`` attribute. You can even control
695+
the ``EntityValueResolver`` behavior by using the `MapEntity options`_ ::
698696

699697
// src/Controller/ProductController.php
700698
namespace App\Controller;
@@ -717,12 +715,11 @@ with it by using the `MapEntity options`_ ::
717715
}
718716
}
719717

720-
721718
Fetch via an Expression
722719
~~~~~~~~~~~~~~~~~~~~~~~
723720

724-
If automatic fetching doesn't work, you can write an expression using the
725-
:doc:`ExpressionLanguage component </components/expression_language>`::
721+
If automatic fetching doesn't work for your use case, you can write an expression
722+
using the :doc:`ExpressionLanguage component </components/expression_language>`::
726723

727724
#[Route('/product/{product_id}')]
728725
public function show(

0 commit comments

Comments
 (0)