I would like to know if there is a way to find tagged services in Command.
I have a Command that extends ContainerAwareCommand
, I'm able to get to container but I would like to get all services that is tagged by a specific tag. For example, I'd like to have something like that:
$this->getContainer()->findTaggedServiceIds('smtp.transport')
Tagged services are only available at build-time of the dependency injection container, not at run-time. So, to get all services with a certain tag you will need to build a compiler pass that saves a list of these services which you can then latter use in your command. This is all described in this document:
http://symfony.com/doc/current/components/dependency_injection/tags.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With