Skip to content

Commit 6007069

Browse files
committed
Add documentation to use AsTaggedItem for value resolver priority/name
1 parent 52cd979 commit 6007069

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

controller/value_resolver.rst

+14
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,20 @@ but you can set it yourself to change its ``priority`` or ``name`` attributes.
425425
;
426426
};
427427
428+
.. code-block:: php-attributes
429+
430+
// src/ValueResolver/BookingIdValueResolver.php
431+
namespace App\ValueResolver;
432+
433+
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
434+
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
435+
436+
#[AsTaggedItem(name: 'booking_id', priority: 150)]
437+
class BookingIdValueResolver implements ValueResolverInterface
438+
{
439+
// ...
440+
}
441+
428442
While adding a priority is optional, it's recommended to add one to make sure
429443
the expected value is injected. The built-in ``RequestAttributeValueResolver``,
430444
which fetches attributes from the ``Request``, has a priority of ``100``. If your

0 commit comments

Comments
 (0)