/** * Add an event subscriber * * @param mixed An object that implements KObjectServiceable, KServiceIdentifier object * or valid identifier string * @param integer The event priority, usually between 1 (high priority) and 5 (lowest), * default is 3. If no priority is set, the command priority will be used * instead. * @return KObject The mixer object */ public function addEventSubscriber($subscriber, $config = array(), $priority = null) { if (!$subscriber instanceof KEventSubscriberInterface) { $subscriber = $this->getEventSubscriber($subscriber, $config); } $priority = is_int($priority) ? $priority : $subscriber->getPriority(); $this->_event_dispatcher->addEventSubscriber($subscriber, $priority); return $this; }
/** * Registers event dispatcher. * * @param KEventDispatcher $dispatcher Event dispatche */ public function registerEventDispatcher(KEventDispatcher $dispatcher) { $dispatcher->addEventSubscriber($this); }