Symfony 2.5.6 error InvalidArgumentException: The service definition "event_dispatcher" does not exist -
I am trying to create my first compiler pass in Symphony 2. For now, I just serve the event_dispatcher from FrameWorkBundle inside a sample bundle, but I get this error:
error InvalidArgumentException: service definition "event_dispatcher" does not exist
< / Pre>This is the code for my compiler:
& lt ;? Php namespace My \ SampleBandli \ dependency injection \ compiler; Use Symfony \ Component \ DependencyInjection \ Compiler; Use Symfony \ Component \ DependencyInjection \ ContainerBuilder; Use Symfony \ Component \ DependencyInjection \ Compiler \ CompilerPassInterface; Class Register Listspace implements CompilerPassInterface {Public Function Process (Containerbuilder $ Container) {$ Definition = $ Container-> GetDefinition ('event_dispatcher'); }}? & Gt;
I am a little surprised because I am taking steps from a professional symphony book which assures me that I will get this service with that ID.
I 'has done some research about it, and I have found out that only the debug event. The dispatcher service was avaible. Then I checked for nicknames and saw that there was a personal surname named 'event_dispatcher' which was debugged. The event_ indicates the dcissue. So I am really confused about that and I am thinking:
- Why is aka private? Do I need to make it public or is it wrong?
- Why does Symfony not automatically interpret my event_dispatcher call?
Thank you for your help! <>>
P>.
findDefinition
also looks for aliases.
Comments
Post a Comment