Skip to content

Commit 59ee885

Browse files
Added fixes after testing xml and php code
1 parent 15c6007 commit 59ee885

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
@@ -619,8 +619,15 @@ The tagged services can be prioritized using the ``priority`` attribute:
619619
.. code-block:: php
620620
621621
// 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+
};
624631
625632
.. note::
626633

@@ -664,15 +671,27 @@ If you want to have another method defining the priority, you can define it in t
664671
https://symfony.com/schema/dic/services/services-1.0.xsd">
665672
<services>
666673
<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"/>
668675
</service>
669676
</services>
670677
</container>
671678
672679
.. code-block:: php
673680
674681
// config/services.php
682+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
683+
675684
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
676685
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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy