Skip to content

Commit 98937bb

Browse files
committed
minor #20509 [DependencyInjection] Make #[AsTaggedItem] repeatable (javiereguiluz)
This PR was merged into the 7.3 branch. Discussion ---------- [DependencyInjection] Make #[AsTaggedItem] repeatable Fixes #20503. Commits ------- 1272701 [DependencyInjection] Make #[AsTaggedItem] repeatable
2 parents 2ccc964 + 1272701 commit 98937bb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

service_container/tags.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,4 +1281,19 @@ be used directly on the class of the service you want to configure::
12811281
// ...
12821282
}
12831283

1284+
You can apply the ``#[AsTaggedItem]`` attribute multiple times to register the
1285+
same service under different indexes:
1286+
1287+
#[AsTaggedItem(index: 'handler_one', priority: 5)]
1288+
#[AsTaggedItem(index: 'handler_two', priority: 20)]
1289+
class SomeService
1290+
{
1291+
// ...
1292+
}
1293+
1294+
.. versionadded:: 7.3
1295+
1296+
The feature to apply the ``#[AsTaggedItem]`` attribute multiple times was
1297+
introduced in Symfony 7.3.
1298+
12841299
.. _`PHP constructor promotion`: https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion

0 commit comments

Comments
 (0)