@@ -685,16 +685,14 @@ Automatic fetching works in these situations:
685
685
*all * of the wildcards in your route that are actually properties
686
686
on your entity (non-properties are ignored).
687
687
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 ``.
689
692
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 `_ ::
698
696
699
697
// src/Controller/ProductController.php
700
698
namespace App\Controller;
@@ -717,12 +715,11 @@ with it by using the `MapEntity options`_ ::
717
715
}
718
716
}
719
717
720
-
721
718
Fetch via an Expression
722
719
~~~~~~~~~~~~~~~~~~~~~~~
723
720
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 >`::
726
723
727
724
#[Route('/product/{product_id}')]
728
725
public function show(
0 commit comments