8000 Added fixes after testing xml and php code · symfony/symfony-docs@217e1ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 217e1ac

Browse files
Added fixes after testing xml and php code
1 parent 07af97a commit 217e1ac

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

service_container/tags.rst

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,15 @@ The tagged services can be prioritized using the ``priority`` attribute:
604604
.. code-block:: php
605605
606606
// 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+
};
609616
610617
.. note::
611618

@@ -649,7 +656,7 @@ If you want to have another method defining the priority, you can define it in t
649656
https://symfony.com/schema/dic/services/services-1.0.xsd">
650657
<services>
651658
<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"/>
653660
</service>
654661
</services>
655662
</container>
@@ -659,5 +666,15 @@ If you want to have another method defining the priority, you can define it in t
659666
// config/services.php
660667
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
661668
662-
$container->register(App\HandlerCollection::class)
663-
->addArgument(new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'));
669+
return function (ContainerConfigurator $configurator) {
670+
$services = $configurator->services();
671+
672+
// ...
673+
674+
$services->set(App\HandlerCollection::class)
675+
->args(
676+
[
677+
new TaggedIteratorArgument('app.handler', null, null, false, 'getPriority'),
678+
]
679+
);
680+
};

0 commit comments

Comments
 (0)
0