Skip to content

Commit ed32333

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Minor Better highlighting [DependencyInjection] Add #[AsTaggedItem] documentation
2 parents 17b880b + 2e6cbc2 commit ed32333

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

service_container/tags.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,3 +893,25 @@ array element. For example, to retrieve the ``handler_two`` handler::
893893
])
894894
;
895895
};
896+
897+
The ``#[AsTaggedItem]`` attribute
898+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
899+
900+
It is possible to define both the priority and the index of a tagged
901+
item thanks to the ``#[AsTaggedItem]`` attribute. This attribute must
902+
be used directly on the class of the service you want to configure::
903+
904+
// src/Handler/One.php
905+
namespace App\Handler;
906+
907+
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
908+
909+
#[AsTaggedItem(index: 'handler_one', priority: 10)]
910+
class One
911+
{
912+
// ...
913+
}
914+
915+
.. versionadded:: 5.3
916+
917+
The ``#[AsTaggedItem]`` attribute was introduced in Symfony 5.3.

0 commit comments

Comments
 (0)