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

Skip to content

Commit 2b5bcd4

Browse files
Added fixes after testing xml and php code
1 parent 07af97a commit 2b5bcd4

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

service_container/tags.rst

Lines changed: 24 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,15 +656,27 @@ 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>
656663
657664
.. code-block:: php
658665
659666
// config/services.php
667+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
668+
660669
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
661670
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

Comments
 (0)
0