當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CComponent類代碼示例

本文整理匯總了PHP中CComponent的典型用法代碼示例。如果您正苦於以下問題:PHP CComponent類的具體用法?PHP CComponent怎麽用?PHP CComponent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CComponent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: attach

 /**
  * Подключение события
  * @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']);
     }
 }
開發者ID:alextravin,項目名稱:yupe,代碼行數:12,代碼來源:LanguageBehavior.php

示例2: attachNonApiRequestBehaviorsForInstalledApplication

 /**
  * @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'));
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:10,代碼來源:CommandBeginRequestBehavior.php

示例3: attach

 /**
  * @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);
 }
開發者ID:kolbensky,項目名稱:rybolove,代碼行數:10,代碼來源:HistoricalBehavior.php

示例4: detach

 /**
  * Detaches the behavior object from the component.
  * The default implementation will unset the {@link owner} property
  * and detach event handlers 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 detached from.
  */
 public function detach($owner)
 {
     foreach ($this->events() as $event => $handler) {
         $owner->detachEventHandler($event, array($this, $handler));
     }
     $this->_owner = null;
 }
開發者ID:jicheng17,項目名稱:yiifamilyblog,代碼行數:14,代碼來源:CBehavior.php

示例5: detach

 /**
  * Detaches the behavior object from the component.
  * The default implementation will unset the {@link owner} property
  * and detach event handlers declared in {@link events}.
  * This method will also set {@link enabled} to false.
  * Make sure you call the parent implementation if you override this method.
  * @param CComponent $owner the component that this behavior is to be detached from.
  */
 public function detach($owner)
 {
     foreach ($this->events() as $event => $handler) {
         $owner->detachEventHandler($event, [$this, $handler]);
     }
     $this->_owner = null;
     $this->_enabled = false;
 }
開發者ID:astar3086,項目名稱:studio_logistic,代碼行數:16,代碼來源:Behavior.php

示例6: attach

 /**
  * @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);
     });
 }
開發者ID:bankiru,項目名稱:yii-pinba,代碼行數:15,代碼來源:EventHandler.php

示例7: setTypeAndComment

 /**
  * Parse existing comments for searching types or comments for property
  *
  * @param CComponent $object
  */
 public function setTypeAndComment(CComponent $object)
 {
     if ($object instanceof CActiveRecord) {
         $scopes = $object->scopes();
         if (isset($scopes[$this->name])) {
             $this->type = get_class($object);
         }
     }
 }
開發者ID:blindest,項目名稱:Yii-CMS-2.0,代碼行數:14,代碼來源:YiiComponentMethod.php

示例8: testBehaviors

 public function testBehaviors()
 {
     $component = new CComponent();
     $hash = new ARedisHash("testAttribute" . uniqid(), $this->getConnection());
     $component->attachBehavior("testAttribute", $hash);
     $this->assertTrue(isset($component->testAttribute));
     $this->assertTrue($component->testAttribute->add("test", true));
     $this->assertTrue((bool) $component->testAttribute['test']);
     $component->testAttribute->clear();
 }
開發者ID:rainsongsky,項目名稱:YiiRedis,代碼行數:10,代碼來源:ARedisHashTest.php

示例9: run

 public function run($args)
 {
     $comp = new CComponent();
     $ubconfig = array_merge(array('class' => 'UpdaterBehavior', 'isConsole' => true, 'noHalt' => true));
     $comp->attachBehavior('UpdaterBehavior', $ubconfig);
     // The files directly involved in the update process:
     $updaterFiles = $comp->updaterFiles;
     // The web-based updater's action classes, which are defined separately:
     $updaterActions = $comp->getWebUpdaterActions(false);
     foreach ($updaterActions as $name => $properties) {
         $updaterFiles[] = UpdaterBehavior::classAliasPath($properties['class']);
     }
     echo "\$deps = ";
     var_export($updaterFiles);
 }
開發者ID:tymiles003,項目名稱:X2CRM,代碼行數:15,代碼來源:UpdaterPackageCommand.php

示例10: attachNonApiRequestBehaviorsForInstalledApplication

 /**
  * @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'));
 }
開發者ID:KulturedKitsch,項目名稱:kulturedkitsch.info,代碼行數:13,代碼來源:CommandBeginRequestBehavior.php

示例11: __get

 /**
  * Overrides the default magic method defined at the CComponent level in order to
  * return a metadata value if parent method fails.
  *
  * @see CComponent::__get()
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (CException $e) {
         if (isset($this->_metadata[$name])) {
             return $this->_metadata[$name];
         } else {
             throw new SWException('Property "' . $name . '" is not found.', SWException::SW_ERR_ATTR_NOT_FOUND);
         }
     }
 }
開發者ID:honglei619,項目名稱:simpleWorkflow,代碼行數:18,代碼來源:SWNode.php

示例12: instantiate

 public function instantiate()
 {
     $component = new CComponent();
     $component->attachBehavior('messageParser', array('class' => 'X2TranslationBehavior'));
     return $component;
 }
開發者ID:tymiles003,項目名稱:X2CRM,代碼行數:6,代碼來源:X2TranslationBehaviorTest.php

示例13: attachNonApiRequestBehaviorsForInstalledApplication

 protected function attachNonApiRequestBehaviorsForInstalledApplication(CComponent $owner)
 {
     $owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection'));
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:4,代碼來源:CommandBeginRequestBehavior.php

示例14: __get

 /**
  * @param string $key
  * @return mixed
  */
 public function __get($key)
 {
     if ($this->exists($key)) {
         return $this->get($key);
     }
     return parent::__get($key);
 }
開發者ID:Clarence-pan,項目名稱:org-wiki,代碼行數:11,代碼來源:Config.php

示例15: __get

 public function __get($name)
 {
     if (in_array($name, EFileMetaData::$attributeLabels)) {
         return $this->getMetaData()->getAttribute($name);
     }
     return parent::__get($name);
 }
開發者ID:sinelnikof,項目名稱:yiiext,代碼行數:7,代碼來源:EFile.php


注:本文中的CComponent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。