简体   繁体   中英

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

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

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM