/** * @param CComponent $owner */ protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner) { $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadActivitiesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadConversationsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadWorkflowsObserver')); }
/** * @param CComponent $owner */ public function attach($owner) { $owner->attachEventHandler('onProductAdded', array($this, 'productAddedEvent')); $owner->attachEventHandler('onProductDeleted', array($this, 'productDeletedEvent')); $owner->attachEventHandler('onProductQuantityChanged', array($this, 'onProductQuantityChanged')); parent::attach($owner); }
/** * @param \CComponent $component * @param string $action * @param string $beginEventName * @param string $endEventName */ public function attach(\CComponent $component, $action, $beginEventName, $endEventName) { $component->attachEventHandler($beginEventName, function (\CEvent $event) use($action) { $this->handleBegin($event, $action); }); $component->attachEventHandler($endEventName, function (\CEvent $event) use($action) { $this->handleEnd($event, $action); }); }
/** * Attaches the behavior object to the component. * The default implementation will set the {@link owner} property * and attach event handlers as declared in {@link events}. * Make sure you call the parent implementation if you override this method. * @param CComponent $owner the component that this behavior is to be attached to. */ public function attach($owner) { $this->_owner = $owner; foreach ($this->events() as $event => $handler) { $owner->attachEventHandler($event, array($this, $handler)); } }
/** * Подключение события * @param CComponent $owner - 'хозяин' события * @return void */ public function attach($owner) { $this->lm = $owner->getUrlManager(); if (is_array($this->lm->languages) && count($this->lm->languages) > 1) { $owner->attachEventHandler('onBeginRequest', [$this, 'handleLanguageBehavior']); } }
/** * Attaches the behavior object to the component. * The default implementation will set the {@link owner} property * and attach event handlers as declared in {@link events}. * Make sure you've declared handler as public and call the parent implementation if you override this method. * @param CComponent $owner the component that this behavior is to be attached to. */ public function attach($owner) { $this->_owner = $owner; $class = new ReflectionClass($this); foreach ($this->events() as $event => $handler) { if (!$class->getMethod($handler)->isProtected()) { $owner->attachEventHandler($event, array($this, $handler)); } } }
/** * @param CComponent $owner */ protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner) { $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadActivitiesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadConversationsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadEmailMessagesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadWorkflowsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadReadPermissionSubscriptionObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadAccountContactAffiliationObserver')); }
protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner) { $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection')); }
/** * @see CommandBeginRequestBehavior, make sure if you change this array, you add anything needed * for the command behavior as well. * @param CComponent $owner */ protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner) { $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleBeginRequest')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleClearCache')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadLanguage')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadTimeZone')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleUserTimeZoneConfirmed')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadActivitiesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadConversationsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadEmailMessagesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadContactLatestActivityDateTimeObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadAccountLatestActivityDateTimeObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadWorkflowsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadReadPermissionSubscriptionObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadAccountContactAffiliationObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadGamification')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleCheckAndUpdateCurrencyRates')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleResolveCustomData')); $owner->attachEventHandler('onBeginRequest', array($this, 'handlePublishLogoAssets')); }
/** * Attach event handler * * @param string $name Event name * @param mixed $handler Event handler */ public function attachEventHandler($name, $handler) { self::$_events[] = array('component' => get_class($this), 'name' => $name, 'handler' => $handler); parent::attachEventHandler($name, $handler); }
protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner) { $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleCheckAutoBuildCompleted')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleBeginRequest')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleClearCache')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadLanguage')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadTimeZone')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleUserTimeZoneConfirmed')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadActivitiesObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadConversationsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadWorkflowsObserver')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleLoadGamification')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleCheckAndUpdateCurrencyRates')); $owner->attachEventHandler('onBeginRequest', array($this, 'handleResolveCustomData')); $owner->attachEventHandler('onBeginRequest', array($this, 'handlePublishLogoAssets')); }