Skip to content

Commit b4af396

Browse files
committed
Add example
1 parent 46b2fe6 commit b4af396

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

service_container/service_subscribers_locators.rst

+6
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ Without autowire
145145

146146
If you are not using autowire you need to require either ``Psr\Container\ContainerInterface`` or ``Symfony\Contracts\Service\ServiceProviderInterface`` as a ``__construct`` argument or as a method call like ``setContainer(Psr\Container\ContainerInterface $container)``.
147147

148+
.. code-block:: diff
149+
$services->set('my_service', SomeClass::class)
150+
+ ->call('setContainer', [service(ContainerInterface::class)])
151+
+ ->tag('container.service_subscriber')
152+
;
153+
148154
Including Services
149155
------------------
150156

0 commit comments

Comments
 (0)