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
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.