/** * {@inheritDoc} */ public function getListeners($eventName = null) { if ($eventName === NULL) { $listeners = []; foreach ($this->evm->getListeners(NULL, TRUE) as $eventName => $subscribers) { list($ns, $event) = Event::parseName($eventName); if ($ns === NULL || stripos($this->namespace, $ns) !== FALSE) { $listeners[$eventName] = $subscribers; } } return $listeners; } list($ns, $event) = Event::parseName($eventName); if ($ns !== NULL) { throw new InvalidArgumentException("Unexpected event with namespace."); } return array_merge($this->evm->getListeners($event), $this->evm->getListeners($this->namespace . $event)); }
/** * @param string $eventName * @param bool $asCallbacks * @return \Doctrine\Common\EventSubscriber[] */ public function getListeners($eventName = NULL) { if (!empty($this->listenerIds[$eventName])) { $this->initializeListener($eventName); } if ($eventName === NULL) { while (($type = key($this->listenerIds)) !== NULL) { $this->initializeListener($type); } } return parent::getListeners($eventName); }