@@ -619,8 +619,15 @@ The tagged services can be prioritized using the ``priority`` attribute:
619
619
.. code-block :: php
620
620
621
621
// config/services.php
622
- $container->register(App\Handler\One::class)
623
- ->addTag('app.handler', ['priority' => 20]);
622
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
623
+
624
+ return function(ContainerConfigurator $configurator) {
625
+ $services = $configurator->services();
626
+
627
+ $services->set(App\Handler\One::class)
628
+ ->tag('app.handler', ['priority' => 20])
629
+ ;
630
+ };
624
631
625
632
.. note ::
626
633
@@ -664,15 +671,27 @@ If you want to have another method defining the priority, you can define it in t
664
671
https://symfony.com/schema/dic/services/services-1.0.xsd" >
665
672
<services >
666
673
<service id =" App\HandlerCollection" >
667
- <argument type =" tagged" tag =" app.handler" default_priority_method =" getPriority" />
674
+ <argument type =" tagged" tag =" app.handler" default-priority-method =" getPriority" />
668
675
</service >
669
676
</services >
670
677
</container >
671
678
672
679
.. code-block :: php
673
680
674
681
// config/services.php
682
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
683
+
675
684
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
676
685
677
- $container->register(App\HandlerCollection::class)
678
- ->addArgument(new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'));
686
+ return function (ContainerConfigurator $configurator) {
687
+ $services = $configurator->services();
688
+
689
+ // ...
690
+
691
+ $services->set(App\HandlerCollection::class)
692
+ ->args(
693
+ [
694
+ new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'),
695
+ ]
696
+ );
697
+ };
0 commit comments