Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6806543 commit 49e2405Copy full SHA for 49e2405
service_container/tags.rst
@@ -897,3 +897,25 @@ array element. For example, to retrieve the ``handler_two`` handler::
897
])
898
;
899
};
900
+
901
+The #[AsTaggedItem] attribute
902
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
903
904
+It is possible to define both the priority and the index of a tagged
905
+item thanks to the ``#[AsTaggedItem]`` attribute. This attribute must
906
+be used directly on the class of the service you want to configure::
907
908
+ // src/Handler/One.php
909
+ namespace App\Handler;
910
911
+ use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
912
913
+ #[AsTaggedItem(index: 'handler_one', priority: 10)]
914
+ class One
915
+ {
916
+ // ...
917
+ }
918
919
+.. versionadded:: 5.3
920
921
+ The ``#[AsTaggedItem]`` attribute was introduced in Symfony 5.3 and requires PHP 8.
0 commit comments