当前位置: 首页>>代码示例>>PHP>>正文


PHP CActiveRecordBehavior::attach方法代码示例

本文整理汇总了PHP中CActiveRecordBehavior::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecordBehavior::attach方法的具体用法?PHP CActiveRecordBehavior::attach怎么用?PHP CActiveRecordBehavior::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CActiveRecordBehavior的用法示例。


在下文中一共展示了CActiveRecordBehavior::attach方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: attach

 /**
  * @param CActiveRecord $owner
  */
 public function attach($owner)
 {
     $validator = new yupe\components\validators\NumberValidator();
     $validator->attributes = array($this->priceAttribute, $this->priceEurAttribute, $this->priceOldAttribute);
     $owner->getValidatorList()->add($validator);
     parent::attach($owner);
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-decor,代码行数:10,代码来源:PriceBehavior.php

示例2: attach

 /**
  * @param CActiveRecord $owner
  */
 public function attach($owner)
 {
     $validator = new CSafeValidator();
     $validator->attributes = array($this->attribute);
     $owner->getValidatorList()->add($validator);
     parent::attach($owner);
 }
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:10,代码来源:DMultiplyListBehavior.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: attach

 public function attach($owner)
 {
     parent::attach($owner);
     $this->_hasCreateDate = $this->getOwner()->hasAttribute('createDate');
     $this->_hasLastUpdated = $this->getOwner()->hasAttribute('lastUpdated');
     $this->_hasLastActivity = $this->getOwner()->hasAttribute('lastActivity');
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:7,代码来源:X2TimestampBehavior.php

示例5: attach

 public function attach($owner)
 {
     parent::attach($owner);
     $this->_model = $owner;
     $this->addRelations();
     $this->addSafeAttributes();
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:7,代码来源:ExtendedARBehavior.php

示例6: attach

 public function attach($owner)
 {
     parent::attach($owner);
     // Set up translatedAttributes.
     foreach ($this->attributes as $attribute) {
         foreach (Yii::app()->languageManager->suffixes as $suffix) {
             $this->_translatedAttributes[] = $attribute . $suffix;
         }
     }
     foreach ($this->_translatedAttributes as $varName) {
         $this->{$varName} = null;
     }
     // Copying validation rules.
     $rules = $owner->rules();
     $validators = $owner->getValidatorList();
     foreach (array_keys(Yii::app()->languageManager->languages) as $l) {
         if ($l != Yii::app()->sourceLanguage) {
             foreach ($this->attributes as $attr) {
                 foreach ($rules as $rule) {
                     $ruleAttributes = array_map('trim', explode(',', $rule[0]));
                     if (in_array($attr, $ruleAttributes)) {
                         $validators->add(CValidator::createValidator($rule[1], $this, $attr . '_' . $l, array_slice($rule, 2)));
                     }
                 }
             }
         }
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:28,代码来源:MultilangVirtualAttributesBehavior.php

示例7: attach

 /**
  * Initialized properties defaults on attaching.
  *
  * @param CActiveRecord $owner behavior owner
  * 
  * @see CBehavior::attach()
  */
 public function attach($owner)
 {
     parent::attach($owner);
     if (!isset($this->saveRelated)) {
         $this->saveRelated = $owner->isNewRecord;
     }
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:14,代码来源:CHasOneBehavior.php

示例8: attach

 /**
  * Attaches the behavior object to the model.
  *
  * @param string $owner The component to which the behavior will be applied
  */
 public function attach($owner)
 {
     parent::attach($owner);
     if ($this->getModule() === null) {
         // Resolve the module
         if (isset($this->baseRoute)) {
             // Try to extract it from $baseRoute (old custom modules)
             $this->module = preg_replace('/\\/.*/', '', preg_replace('/^\\//', '', $this->baseRoute));
         } else {
             // Assume the model name is the same as the module/controller
             // (also true of custom modules)
             $this->module = strtolower(get_class($this->owner));
         }
     }
     if (!isset($this->baseRoute)) {
         $this->baseRoute = '/' . $this->module;
     }
     if (!isset($this->viewRoute)) {
         $this->viewRoute = $this->baseRoute;
     }
     if (Yii::app()->params->isMobileApp) {
         $this->viewRoute .= '/mobileView';
     }
     if (!isset($this->autoCompleteSource)) {
         $this->autoCompleteSource = $this->baseRoute . '/getItems?modelType=' . get_class($this->owner);
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:32,代码来源:X2LinkableBehavior.php

示例9: attach

 /**
  * @param CActiveRecord $owner
  */
 public function attach($owner)
 {
     parent::attach($owner);
     if (!is_null($this->_getEavSet())) {
         $this->_attachEavAttributes();
     }
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:10,代码来源:EavBehavior.php

示例10: attach

 /**
  * Attaches dynamic relations.
  * 
  * @param CActiveRecord $owner owner
  * 
  * @see CBehavior::attach()
  */
 public function attach($owner)
 {
     parent::attach($owner);
     $ownerClassName = get_class($owner);
     $metaData = $owner->getMetaData();
     $metaData->addRelation('parent', array(CActiveRecord::BELONGS_TO, $ownerClassName, $this->parentIdColumn));
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:14,代码来源:AdjacencyTreeBehavior.php

示例11: attach

 /**
  * (non-PHPdoc).
  * 
  * @see CBehavior::attach()
  */
 public function attach($owner)
 {
     parent::attach($owner);
     if (!isset($this->defaultCounter)) {
         $this->defaultCounter = $this->counters[0];
     }
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:12,代码来源:ArCounterBehavior.php

示例12: attach

 /**
  * Attaches the behavior to the owner
  * @see CActiveRecordBehavior::attach()
  * @param CComponent $component The component to attach to
  */
 public function attach($component)
 {
     parent::attach($component);
     foreach ($this->_attributes as $name => $attribute) {
         $attribute->owner = $this->owner;
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:12,代码来源:AResourceful.php

示例13: attach

 /**
  * Check required properties and attaches the behavior object to the component.
  * @param CComponent owner component.
  * @throws CException if required properties not set.
  */
 public function attach($owner)
 {
     // Check required var statusField.
     if (!is_string($this->statusField) || empty($this->statusField)) {
         throw new CException(self::t('yii', 'Property "{class}.{property}" is not defined.', array('{class}' => get_class($this), '{property}' => 'statusField')));
     }
     parent::attach($owner);
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:13,代码来源:EStatusBehavior.php

示例14: attach

 public function attach($owner)
 {
     $validators = $owner->getValidatorList();
     foreach ($this->rules() as $rule) {
         $validators->add(CValidator::createValidator($rule[1], $owner, $rule[0], array_slice($rule, 2)));
     }
     parent::attach($owner);
 }
开发者ID:nellka,项目名称:mebel,代码行数:8,代码来源:SEOBehavior.php

示例15: attach

 public function attach($owner)
 {
     // Check required var trashFlagField
     if (!is_string($this->trashFlagField) || empty($this->trashFlagField)) {
         throw new CException(Yii::t('yiiext', 'Required var "{class}.{property}" not set.', array('{class}' => get_class($this), '{property}' => 'trashFlagField')));
     }
     parent::attach($owner);
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:8,代码来源:ETrashBinBehavior.php


注:本文中的CActiveRecordBehavior::attach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。