Skip to content

Commit 276fa8e

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Minor Better highlighting [DependencyInjection] Add #[AsTaggedItem] documentation
2 parents fc7af9c + 6e0e91b commit 276fa8e

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
@@ -978,3 +978,25 @@ array element. For example, to retrieve the ``handler_two`` handler::
978978
])
979979
;
980980
};
981+
982+
The ``#[AsTaggedItem]`` attribute
983+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
984+
985+
It is possible to define both the priority and the index of a tagged
986+
item thanks to the ``#[AsTaggedItem]`` attribute. This attribute must
987+
be used directly on the class of the service you want to configure::
988+
989+
// src/Handler/One.php
990+
namespace App\Handler;
991+
992+
use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
993+
994+
#[AsTaggedItem(index: 'handler_one', priority: 10)]
995+
class One
996+
{
997+
// ...
998+
}
999+
1000+
.. versionadded:: 5.3
1001+
1002+
The ``#[AsTaggedItem]`` attribute was introduced in Symfony 5.3.

0 commit comments

Comments
 (0)