Skip to content

Commit 69f5c25

Browse files
committed
Add documentation to use AsTaggedItem for value resolver priority/name
1 parent 669c72b commit 69f5c25

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

controller/value_resolver.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,20 @@ but you can set it yourself to change its ``priority`` or ``name`` attributes.
384384
;
385385
};
386386
387+
.. code-block:: php-attributes
388+
389+
// src/ValueResolver/IdentifierValueResolver.php
390+
namespace App\ValueResolver;
391+
392+
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
393+
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
394+
395+
#[AsTaggedItem(name: 'booking_id', priority: 150)]
396+
class BookingIdValueResolver implements ValueResolverInterface
397+
{
398+
// ...
399+
}
400+
387401
While adding a priority is optional, it's recommended to add one to make sure
388402
the expected value is injected. The built-in ``RequestAttributeValueResolver``,
389403
which fetches attributes from the ``Request``, has a priority of ``100``. If your

0 commit comments

Comments
 (0)