Dr. Z
Dr. Z

Reputation: 237

Symfony 3.0.1 EventDispatcher

I'm writing a RequestListener and I look like to get the EventDispatcher. It was working on previous version of Symfony. I checked the CHANGELOG.md :

The method getListenerPriority($eventName, $listener) has been added to the EventDispatcherInterface. The methods Event::setDispatcher(), Event::getDispatcher(), Event::setName() and Event::getName() have been removed. The event dispatcher and the event name are passed to the listener call.

public function onKernelRequest(GetResponseEvent $event) {
  $dispatcher = $event->getDispatcher();
}

How can I get the event dispatcher ?

Thanks

Upvotes: 0

Views: 250

Answers (1)

Cerad
Cerad

Reputation: 48893

http://symfony.com/doc/current/components/event_dispatcher/introduction.html#eventdispatcher-aware-events-and-listeners

public function onKernelRequest(
  GetResponseEvent $event, 
  $eventName, 
  EventDispatcherInterface $dispatcher) 
{

}

Upvotes: 4

Related Questions