File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,27 @@ PSR-7 Objects Resolver:
204
204
:class: `Psr\\ Http\\ Message\\ RequestInterface ` or :class: `Psr\\ Http\\ Message\\ MessageInterface `.
205
205
It requires installing :doc: `the PSR-7 Bridge </components/psr7 >` component.
206
206
207
+ Managing Value Resolvers
208
+ ------------------------
209
+
210
+ For each argument, every available resolver will be called until one provides a value.
211
+ The order in which they are called depends on their priority.
212
+ For example, the ``SessionValueResolver `` (priority 50) will be called before the
213
+ ``DefaultValueResolver `` (priority -100) which allows to write e.g.
214
+ ``SessionInterface $session = null `` to get the session if there is one, or ``null ``
215
+ if there is none.
216
+
217
+ But what if you *know * there will be a session? In that case every resolver running
218
+ before ``SessionValueResolver `` is useless. Worse, some other resolver could actually
219
+ provide a value before ``SessionValueResolver `` has a chance to (don't worry though,
220
+ this won't happen with built-in resolvers). Since Symfony 6.3, you can leverage the
221
+ :class: `Symfony\\ Component\\ HttpKernel\\ Attribute\\ ValueResolver ` to avoid this kind of
222
+ issue.
223
+
224
+ .. versionadded :: 6.3
225
+
226
+ The ``ValueResolver `` attribute was introduced in Symfony 6.3.
227
+
207
228
Adding a Custom Value Resolver
208
229
------------------------------
209
230
You can’t perform that action at this time.
0 commit comments