@@ -604,8 +604,15 @@ The tagged services can be prioritized using the ``priority`` attribute:
604
604
.. code-block :: php
605
605
606
606
// config/services.php
607
- $container->register(App\Handler\One::class)
608
- ->addTag('app.handler', ['priority' => 20]);
607
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
608
+
609
+ return function(ContainerConfigurator $configurator) {
610
+ $services = $configurator->services();
611
+
612
+ $services->set(App\Handler\One::class)
613
+ ->tag('app.handler', ['priority' => 20])
614
+ ;
615
+ };
609
616
610
617
.. note ::
611
618
@@ -649,15 +656,27 @@ If you want to have another method defining the priority, you can define it in t
649
656
https://symfony.com/schema/dic/services/services-1.0.xsd" >
650
657
<services >
651
658
<service id =" App\HandlerCollection" >
652
- <argument type =" tagged" tag =" app.handler" default_priority_method =" getPriority" />
659
+ <argument type =" tagged" tag =" app.handler" default-priority-method =" getPriority" />
653
660
</service >
654
661
</services >
655
662
</container >
656
663
657
664
.. code-block :: php
658
665
659
666
// config/services.php
667
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
668
+
660
669
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
661
670
662
- $container->register(App\HandlerCollection::class)
663
- ->addArgument(new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'));
671
+ return function (ContainerConfigurator $configurator) {
672
+ $services = $configurator->services();
673
+
674
+ // ...
675
+
676
+ $services->set(App\HandlerCollection::class)
677
+ ->args(
678
+ [
679
+ new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'),
680
+ ]
681
+ );
682
+ };
0 commit comments