Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55a87b5

Browse files
author
Iltar van der Berg
committed
Minor fixes
1 parente3d1b48 commit55a87b5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎cookbook/controller/argument_value_resolver.rst‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ and adding a priority.
149149

150150
While adding a priority is optional, it's recommended to add one to
151151
make sure the expected value is injected. The ``ArgumentFromAttributeResolver``
152-
has a priority of 100. As thisone is responsible for fetching attributes
152+
has a priority of 100. As this one is responsible for fetching attributes
153153
from the ``Request``, it's also recommended to trigger your custom value
154154
resolver with a lower priority. This makes sure the argument resolvers
155155
are not triggered in (e.g.) subrequests if you pass your user along:
@@ -197,8 +197,6 @@ and adding a priority.
197197
$definition->addTag('controller.argument_value_resolver', array('priority' => 50));
198198
$container->setDefinition('app.value_resolver.user', $definition);
199199
200-
.. _`yield`:http://php.net/manual/en/language.generators.syntax.php
201-
202200
Creating an Optional User Resolver
203201
----------------------------------
204202

@@ -209,13 +207,17 @@ method signature to `UserInterface $user = null`.
209207

210208
When you take the ``UserValueResolver`` from the previous example, you can
211209
see there is no logic in case of failure to comply to the requirements. Default
212-
valuesinare defined in the signature and are available in the ``ArgumentMetadata``.
210+
values are defined in the signature and are available in the ``ArgumentMetadata``.
213211
When a default value is available and there are no resolvers that support
214212
the given value, the ``DefaultValueResolver`` is triggered. This Resolver
215213
takes the default value of your argument and yields it to the argument list::
216214

217215
namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
218216

217+
use Symfony\Component\HttpFoundation\Request;
218+
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
219+
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
220+
219221
final class DefaultValueResolver implements ArgumentValueResolverInterface
220222
{
221223
public function supports(Request $request, ArgumentMetadata $argument)
@@ -228,3 +230,5 @@ takes the default value of your argument and yields it to the argument list::
228230
yield $argument->getDefaultValue();
229231
}
230232
}
233+
234+
.. _`yield`:http://php.net/manual/en/language.generators.syntax.php

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp