@@ -410,17 +410,16 @@ Reference Tagged Services
410
410
~~~~~~~~~~~~~~~~~~~~~~~~~
411
411
412
412
.. versionadded :: 3.4
413
-
414
413
Support for the tagged service notation in YAML, XML and PHP was introduced
415
414
in Symfony 3.4.
416
415
417
- If you use tags to inject a list of services as an argument, writing a compiler
418
- pass is a bit tedious. As this is a very common case, Symfony provides a way to
419
- inject all services tagged with a specific tag.
416
+ Symfony provides a shortcut to inject all services tagged with a specific tag,
417
+ which is a common need in some applications, so you don't have to write a
418
+ compiler pass just for that. The only downside of this feature is that you can't
419
+ have any custom attributes.
420
420
421
- The downside of this feature is that you can't have any custom attributes. In the
422
- example below, all services tagged with ``app.handler `` are passed as first
423
- constructor argument to the ``App\HandlerCollection `` service:
421
+ In the following example, all services tagged with ``app.handler `` are passed as
422
+ first constructor argument to the ``App\HandlerCollection `` service:
424
423
425
424
.. configuration-block ::
426
425
@@ -475,7 +474,8 @@ constructor argument to the ``App\HandlerCollection`` service:
475
474
// inject all services tagged with app.handler as first argument
476
475
->addArgument(new TaggedIteratorArgument('app.handler'));
477
476
478
- After compilation the ``HandlerCollection `` service is able to iterate over your application handlers.
477
+ After compilation the ``HandlerCollection `` service is able to iterate over your
478
+ application handlers.
479
479
480
480
.. code-block :: php
481
481
@@ -488,7 +488,7 @@ After compilation the ``HandlerCollection`` service is able to iterate over your
488
488
489
489
.. tip ::
490
490
491
- The collected services can be prioritized using the `priority ` attribute.
491
+ The collected services can be prioritized using the `` priority ` ` attribute.
492
492
493
493
.. code-block :: yaml
494
494
0 commit comments