[EventDispatcher] Try first if the event is Stopped
This commit is contained in:
parent
131436525f
commit
a30e1662d8
@ -155,10 +155,10 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
protected function doDispatch($listeners, $eventName, Event $event)
|
protected function doDispatch($listeners, $eventName, Event $event)
|
||||||
{
|
{
|
||||||
foreach ($listeners as $listener) {
|
foreach ($listeners as $listener) {
|
||||||
call_user_func($listener, $event);
|
|
||||||
if ($event->isPropagationStopped()) {
|
if ($event->isPropagationStopped()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
call_user_func($listener, $event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,10 @@ class TraceableEventDispatcher implements EventDispatcherInterface, TraceableEve
|
|||||||
$event = new Event();
|
$event = new Event();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null !== $this->logger && $event->isPropagationStopped()) {
|
||||||
|
$this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
|
||||||
|
}
|
||||||
|
|
||||||
$eventId = ++$this->lastEventId;
|
$eventId = ++$this->lastEventId;
|
||||||
|
|
||||||
$this->preDispatch($eventName, $eventId, $event);
|
$this->preDispatch($eventName, $eventId, $event);
|
||||||
|
Reference in New Issue
Block a user