I have a listener and i would like to send an event to that listener. Now this listener should be a global listener, this means that i do not like to intantiate the listener every time i need it, i should just be able to send an event any time to that listener without making it each time. Is this possible ?
myname.listener.mylistener_send:
class: MyName\MyBundle\Listeners\MyListenerSend
tags:
- { name: kernel.event_listener, event: myListener.send, method: onFooSend }
arguments: [ @logger, @myListener.helper]
Just define it as a service and the Symfony DIC will instantiate that listener for you.