eventDispatcher = $eventDispatcher; return $this; } public function getEventDispatcher() { if (!$this->eventDispatcher) { $this->eventDispatcher = new EventDispatcher(); } return $this->eventDispatcher; } public function dispatch($eventName, array $context = array()) { return $this->getEventDispatcher()->dispatch($eventName, new Event($context)); } public function addSubscriber(EventSubscriberInterface $subscriber) { $this->getEventDispatcher()->addSubscriber($subscriber); return $this; } }