@@ -677,27 +677,16 @@ will automatically fetch them::
677
677
{
678
678
}
679
679
680
- /**
681
- * Perform a findOneBy() where the slug property matches {slug}.
682
- */
683
- #[Route('/product/{slug}')]
684
- public function showBySlug(Product $product): Response
685
- {
686
- }
680
+ Automatic fetching works if ``{id} `` is in your route, then this is used to
681
+ fetch by primary key via the ``find() `` method.
687
682
688
- Automatic fetching works in these situations:
689
-
690
- * If ``{id} `` is in your route, then this is used to fetch by
691
- primary key via the ``find() `` method.
692
-
693
- * The resolver will attempt to do a ``findOneBy() `` fetch by using
694
- *all * of the wildcards in your route that are actually properties
695
- on your entity (non-properties are ignored).
683
+ .. versionadded :: 7.1
696
684
697
- This behavior is enabled by default on all controllers. If you prefer, you can
698
- restrict this feature to only work on route wildcards called ``id `` to look for
699
- entities by primary key. To do so, set the option
700
- ``doctrine.orm.controller_resolver.auto_mapping `` to ``false ``.
685
+ Prior to Symfony 7.1, automatic fetching was enabled on *all * of the
686
+ of the wildcards in your route that are actually properties on your entity.
687
+ This behavior is now disabled by default to only work on route wildcards
688
+ called ``id ``. To do so, set the option
689
+ ``doctrine.orm.controller_resolver.auto_mapping `` to ``true ``.
701
690
702
691
When ``auto_mapping `` is disabled, you can configure the mapping explicitly for
703
692
any controller argument with the ``MapEntity `` attribute. You can even control
0 commit comments