public function dispatch($eventName, Event $event = null) { if (null === $event) { $event = new Event(); } parent::dispatch($eventName, $event); $silexEvent = $this->getProxyMapper()->createProxyEvent($event); if ($silexEvent) { $this->eventManager->trigger($silexEvent); } return $event; }
/** * Calls given proxy event * Throws an exception if event was cancelled * * @param ProxyEventInterface $event */ private function callProxyEvent(ProxyEventInterface $event) { if ($event instanceof LoggerAwareInterface) { $event->setLogger($this->logger); } $this->eventManager->trigger($event); if ($event instanceof CancellableEventInterface && $event->isCancelled()) { throw new CancelledEventException($event); } }