@@ -426,13 +426,13 @@ first constructor argument to the ``App\HandlerCollection`` service:
426
426
427
427
# app/config/services.yml
428
428
services :
429
- App \Handler\One :
429
+ AppBundle \Handler\One :
430
430
tags : [app.handler]
431
431
432
- App \Handler\Two :
432
+ AppBundle \Handler\Two :
433
433
tags : [app.handler]
434
434
435
- App \HandlerCollection :
435
+ AppBundle \HandlerCollection :
436
436
# inject all services tagged with app.handler as first argument
437
437
arguments : [!tagged app.handler]
438
438
@@ -446,15 +446,15 @@ first constructor argument to the ``App\HandlerCollection`` service:
446
446
http://symfony.com/schema/dic/services/services-1.0.xsd" >
447
447
448
448
<services >
449
- <service id =" App \Handler\One" >
449
+ <service id =" AppBundle \Handler\One" >
450
450
<tag name =" app.handler" />
451
451
</service >
452
452
453
- <service id =" App \Handler\Two" >
453
+ <service id =" AppBundle \Handler\Two" >
454
454
<tag name =" app.handler" />
455
455
</service >
456
456
457
- <service id =" App \HandlerCollection" >
457
+ <service id =" AppBundle \HandlerCollection" >
458
458
<!-- inject all services tagged with app.handler as first argument -->
459
459
<argument type =" tagged" tag =" app.handler" />
460
460
</service >
@@ -466,13 +466,13 @@ first constructor argument to the ``App\HandlerCollection`` service:
466
466
// app/config/services.php
467
467
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
468
468
469
- $container->register(App \Handler\One::class)
469
+ $container->register(AppBundle \Handler\One::class)
470
470
->addTag('app.handler');
471
471
472
- $container->register(App \Handler\Two::class)
472
+ $container->register(AppBundle \Handler\Two::class)
473
473
->addTag('app.handler');
474
474
475
- $container->register(App \HandlerCollection::class)
475
+ $container->register(AppBundle \HandlerCollection::class)
476
476
// inject all services tagged with app.handler as first argument
477
477
->addArgument(new TaggedIteratorArgument('app.handler'));
478
478
@@ -481,6 +481,9 @@ application handlers.
481
481
482
482
.. code-block :: php
483
483
484
+ // src/AppBundle/HandlerCollection.php
485
+ namespace AppBundle;
486
+
484
487
class HandlerCollection
485
488
{
486
489
public function __construct(iterable $handlers)
@@ -498,7 +501,7 @@ application handlers.
498
501
499
502
# app/config/services.yml
500
503
services :
501
- App \Handler\One :
504
+ AppBundle \Handler\One :
502
505
tags :
503
506
- { name: app.handler, priority: 20 }
504
507
@@ -512,7 +515,7 @@ application handlers.
512
515
http://symfony.com/schema/dic/services/services-1.0.xsd" >
513
516
514
517
<services >
515
- <service id =" App \Handler\One" >
518
+ <service id =" AppBundle \Handler\One" >
516
519
<tag name =" app.handler" priority =" 20" />
517
520
</service >
518
521
</services >
@@ -521,8 +524,7 @@ application handlers.
521
524
.. code-block :: php
522
525
523
526
// app/config/services.php
524
- $container->register(App \Handler\One::class)
527
+ $container->register(AppBundle \Handler\One::class)
525
528
->addTag('app.handler', array('priority' => 20));
526
529
527
530
Note that any other custom attributes will be ignored by this feature.
528
-
0 commit comments