Skip to content

Commit 27c9899

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: Add documentation to use `AsTaggedItem` for value resolver priority/name
2 parents 31df003 + 8b20cc8 commit 27c9899

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

controller/value_resolver.rst

+16-2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ this argument) or an array with the resolved value(s). Usually arguments are
281281
resolved as a single value, but variadic arguments require resolving multiple
282282
values. That's why you must always return an array, even for single values::
283283

284-
// src/ValueResolver/IdentifierValueResolver.php
284+
// src/ValueResolver/BookingIdValueResolver.php
285285
namespace App\ValueResolver;
286286

287287
use App\IdentifierInterface;
@@ -333,6 +333,20 @@ but you can set it yourself to change its ``priority`` or ``name`` attributes.
333333

334334
.. configuration-block::
335335

336+
.. code-block:: php-attributes
337+
338+
// src/ValueResolver/BookingIdValueResolver.php
339+
namespace App\ValueResolver;
340+
341+
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
342+
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
343+
344+
#[AsTaggedItem(name: 'booking_id', priority: 150)]
345+
class BookingIdValueResolver implements ValueResolverInterface
346+
{
347+
// ...
348+
}
349+
336350
.. code-block:: yaml
337351
338352
# config/services.yaml
@@ -414,7 +428,7 @@ As an alternative, you can add the
414428
:class:`Symfony\\Component\\HttpKernel\\Attribute\\AsTargetedValueResolver` attribute
415429
to your resolver and pass your custom name as its first argument::
416430

417-
// src/ValueResolver/IdentifierValueResolver.php
431+
// src/ValueResolver/BookingIdValueResolver.php
418432
namespace App\ValueResolver;
419433

420434
use Symfony\Component\HttpKernel\Attribute\AsTargetedValueResolver;

0 commit comments

Comments
 (0)