We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 738c893 commit 7c1a4b4Copy full SHA for 7c1a4b4
service_container/service_subscribers_locators.rst
@@ -570,6 +570,23 @@ Now you can inject the service locator in any other services:
570
571
.. configuration-block::
572
573
+ .. code-block:: php-attributes
574
+
575
+ // src/CommandBus.php
576
+ namespace App;
577
578
+ use Psr\Container\ContainerInterface;
579
+ use Symfony\Component\DependencyInjection\Attribute\Autowire;
580
581
+ class CommandBus
582
+ {
583
+ public function __construct(
584
+ #[Autowire(service: 'app.command_handler_locator')]
585
+ private ContainerInterface $locator,
586
+ ) {
587
+ }
588
589
590
.. code-block:: yaml
591
592
# config/services.yaml
0 commit comments