Reputation: 3
In Symfony2, is it possible to define a Service in the Service Container that has the Service Container as a dependance? I'm trying to build a CommandDispatcher which will pass a Command to the appropriate CommandHandler. To be able to do this, the CommandDispatcher needs the Container to query it for the appropriate CommandHandler.
Example service XML:
<service id="command_dispatcher" class="CommandDispatcher">
<argument type="service" id="Container"/>
</service>
Upvotes: 0
Views: 38
Reputation: 1886
The id for the argument should be 'service_container'
Do
<service id="command_dispatcher" class="CommandDispatcher">
<argument type="service" id="service_container"/>
</service>
Upvotes: 1