@@ -425,6 +425,7 @@ first constructor argument to the ``App\HandlerCollection`` service:
425425
426426 .. code-block :: yaml
427427
428+ # app/config/services.yml
428429 services :
429430 App\Handler\One :
430431 tags : [app.handler]
@@ -438,6 +439,7 @@ first constructor argument to the ``App\HandlerCollection`` service:
438439
439440 .. code-block :: xml
440441
442+ <!-- app/config/services.xml -->
441443 <?xml version =" 1.0" encoding =" UTF-8" ?>
442444 <container xmlns =" http://symfony.com/schema/dic/services"
443445 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
@@ -462,15 +464,16 @@ first constructor argument to the ``App\HandlerCollection`` service:
462464
463465 .. code-block :: php
464466
467+ // app/config/services.php
465468 use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
466469
467- $container->register(\ App\Handler\One::class)
470+ $container->register(App\Handler\One::class)
468471 ->addTag('app.handler');
469472
470- $container->register(\ App\Handler\Two::class)
473+ $container->register(App\Handler\Two::class)
471474 ->addTag('app.handler');
472475
473- $container->register(\ App\HandlerCollection::class)
476+ $container->register(App\HandlerCollection::class)
474477 // inject all services tagged with app.handler as first argument
475478 ->addArgument(new TaggedIteratorArgument('app.handler'));
476479
@@ -488,11 +491,37 @@ application handlers.
488491
489492 .. tip ::
490493
491- The collected services can be prioritized using the ``priority `` attribute.
494+ The collected services can be prioritized using the ``priority `` attribute:
492495
493- .. code-block :: yaml
496+
497+ .. configuration-block ::
494498
495- services :
496- App\Handler\One :
497- tags :
498- - { name: app.handler, priority: 20 }
499+ .. code-block :: yaml
500+
501+ # app/config/services.yml
502+ services :
503+ App\Handler\One :
504+ tags :
505+ - { name: app.handler, priority: 20 }
506+
507+ .. code-block :: xml
508+
509+ <!-- app/config/services.xml -->
510+ <?xml version =" 1.0" encoding =" UTF-8" ?>
511+ <container xmlns =" http://symfony.com/schema/dic/services"
512+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
513+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
514+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
515+
516+ <services >
517+ <service id =" App\Handler\One" >
518+ <tag name =" app.handler" priority =" 20" />
519+ </service >
520+ </services >
521+ </container >
522+
523+ .. code-block :: php
524+
525+ // app/config/services.php
526+ $container->register(App\Handler\One::class)
527+ ->addTag('app.handler', array('priority' => 20));
0 commit comments