@@ -146,7 +146,7 @@ Symfony ships with the following value resolvers in the
146
146
argument list. When the action is called, the last (variadic) argument will
147
147
contain all the values of this array.
148
148
149
- In addition, some components and official bundles provide other value resolvers:
149
+ In addition, some components, bridges and official bundles provide other value resolvers:
150
150
151
151
:class: `Symfony\\ Component\\ Security\\ Http\\ Controller\\ UserValueResolver `
152
152
Injects the object that represents the current logged in user if type-hinted
@@ -159,6 +159,33 @@ In addition, some components and official bundles provide other value resolvers:
159
159
user has a user class not matching the type-hinted class, an ``AccessDeniedException ``
160
160
is thrown by the resolver to prevent access to the controller.
161
161
162
+ :class: `Symfony\\ Bridge\\ Doctrine\\ ArgumentResolver\\ EntityValueResolver `
163
+ Automatically query for an entity and pass it as an argument to your controller.
164
+
165
+ For example, the following will query the ``Product `` entity which has ``{id} `` as primary key::
166
+
167
+ // src/Controller/DefaultController.php
168
+ namespace App\Controller;
169
+
170
+ use Symfony\Component\HttpFoundation\Response;
171
+ use Symfony\Component\Routing\Annotation\Route;
172
+
173
+ class DefaultController
174
+ {
175
+ #[Route('/product/{id}')]
176
+ public function share(Product $product): Response
177
+ {
178
+ // ...
179
+ }
180
+ }
181
+
182
+ To learn more about the use of the ``EntityValueResolver ``, see the dedicated
183
+ section :ref: `Automatically Fetching Objects <doctrine-entity-value-resolver >`.
184
+
185
+ .. versionadded :: 6.2
186
+
187
+ The ``EntityValueResolver `` was introduced in Symfony 6.2.
188
+
162
189
PSR-7 Objects Resolver:
163
190
Injects a Symfony HttpFoundation ``Request `` object created from a PSR-7 object
164
191
of type :class: `Psr\\ Http\\ Message\\ ServerRequestInterface `,
0 commit comments