Skip to content

Commit ed70659

Browse files
authored
Update tags.rst
1 parent 2e5c87f commit ed70659

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

service_container/tags.rst

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,13 @@ first constructor argument to the ``App\HandlerCollection`` service:
426426
427427
# app/config/services.yml
428428
services:
429-
App\Handler\One:
429+
AppBundle\Handler\One:
430430
tags: [app.handler]
431431
432-
App\Handler\Two:
432+
AppBundle\Handler\Two:
433433
tags: [app.handler]
434434
435-
App\HandlerCollection:
435+
AppBundle\HandlerCollection:
436436
# inject all services tagged with app.handler as first argument
437437
arguments: [!tagged app.handler]
438438
@@ -446,15 +446,15 @@ first constructor argument to the ``App\HandlerCollection`` service:
446446
http://symfony.com/schema/dic/services/services-1.0.xsd">
447447
448448
<services>
449-
<service id="App\Handler\One">
449+
<service id="AppBundle\Handler\One">
450450
<tag name="app.handler" />
451451
</service>
452452
453-
<service id="App\Handler\Two">
453+
<service id="AppBundle\Handler\Two">
454454
<tag name="app.handler" />
455455
</service>
456456
457-
<service id="App\HandlerCollection">
457+
<service id="AppBundle\HandlerCollection">
458458
<!-- inject all services tagged with app.handler as first argument -->
459459
<argument type="tagged" tag="app.handler" />
460460
</service>
@@ -466,13 +466,13 @@ first constructor argument to the ``App\HandlerCollection`` service:
466466
// app/config/services.php
467467
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
468468
469-
$container->register(App\Handler\One::class)
469+
$container->register(AppBundle\Handler\One::class)
470470
->addTag('app.handler');
471471
472-
$container->register(App\Handler\Two::class)
472+
$container->register(AppBundle\Handler\Two::class)
473473
->addTag('app.handler');
474474
475-
$container->register(App\HandlerCollection::class)
475+
$container->register(AppBundle\HandlerCollection::class)
476476
// inject all services tagged with app.handler as first argument
477477
->addArgument(new TaggedIteratorArgument('app.handler'));
478478
@@ -481,6 +481,9 @@ application handlers.
481481

482482
.. code-block:: php
483483
484+
// src/AppBundle/HandlerCollection.php
485+
namespace AppBundle;
486+
484487
class HandlerCollection
485488
{
486489
public function __construct(iterable $handlers)
@@ -498,7 +501,7 @@ application handlers.
498501
499502
# app/config/services.yml
500503
services:
501-
App\Handler\One:
504+
AppBundle\Handler\One:
502505
tags:
503506
- { name: app.handler, priority: 20 }
504507
@@ -512,7 +515,7 @@ application handlers.
512515
http://symfony.com/schema/dic/services/services-1.0.xsd">
513516
514517
<services>
515-
<service id="App\Handler\One">
518+
<service id="AppBundle\Handler\One">
516519
<tag name="app.handler" priority="20" />
517520
</service>
518521
</services>
@@ -521,8 +524,7 @@ application handlers.
521524
.. code-block:: php
522525
523526
// app/config/services.php
524-
$container->register(App\Handler\One::class)
527+
$container->register(AppBundle\Handler\One::class)
525528
->addTag('app.handler', array('priority' => 20));
526529
527530
Note that any other custom attributes will be ignored by this feature.
528-

0 commit comments

Comments
 (0)