Skip to content

Commit d2ad157

Browse files
authored
fetch automatically is disabled in 7.1
1 parent 708b256 commit d2ad157

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

doctrine.rst

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -677,27 +677,16 @@ will automatically fetch them::
677677
{
678678
}
679679

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.
687682

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
696684

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``.
701690

702691
When ``auto_mapping`` is disabled, you can configure the mapping explicitly for
703692
any controller argument with the ``MapEntity`` attribute. You can even control

0 commit comments

Comments
 (0)