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


PHP CActiveRecordBehavior::afterFind方法代码示例

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


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

示例1: afterFind

 public function afterFind($event)
 {
     if ($this->getAttribute() !== NULL) {
         $this->_value = $this->getOwner()->getAttribute($this->getAttribute());
     }
     return parent::afterFind($event);
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:7,代码来源:ELastValueBehavior.php

示例2: afterFind

 public function afterFind($event)
 {
     parent::afterFind($event);
     //это не открывать, работает для всех взаимосвязанных элементов
     // if(!Common::isCLI() && ($history = request()->getParam('history')) ){
     //  $this->getFullHistory($history);
     // }
 }
开发者ID:amanukian,项目名称:test,代码行数:8,代码来源:HistoricalBehavior.php

示例3: afterFind

 /**
  * Decripts the values of specified attributes after finding from database
  * @param CEvent $event
  * @return parent::afterFind
  */
 public function afterFind($event)
 {
     foreach ($this->getOwner()->getAttributes() as $key => $value) {
         if (in_array($key, $this->attributes) && !empty($value)) {
             if ($this->useAESMySql) {
                 $this->getOwner()->{$key} = $this->mysqlAESDecrypt($value, Yii::app()->securityManager->getEncryptionKey());
             } else {
                 $this->getOwner()->{$key} = Yii::app()->securityManager->decrypt(utf8_decode($value));
             }
         }
     }
     return parent::afterFind($event);
 }
开发者ID:LumbaJack,项目名称:Mercado-BTX,代码行数:18,代码来源:ECryptBehavior.php

示例4: afterFind

 public function afterFind($event)
 {
     $owner = $this->getOwner();
     foreach ($this->attributes as $attr) {
         if (isset($owner->{$attr})) {
             $date = new DateTime($owner->{$attr});
             $date->setTimezone(new DateTimeZone(Yii::app()->controller->timezone));
             $owner->setAttribute($attr, $date->format('Y-m-d H:i:s'));
         } else {
             //throw exception
         }
     }
     parent::afterFind($event);
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:14,代码来源:TimezoneBehavior.php

示例5: afterFind

 /**
  * Converts ISO 9075 dates to $dateFormat after read from database
  */
 public function afterFind($event)
 {
     foreach ($this->dateColumns as $date) {
         $_dt = $this->Owner->{$date};
         if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $_dt, $regs)) {
             $_dt = $regs[3] . "/" . $regs[2] . "/" . $regs[1];
         }
         if ($_dt == '00/00/0000') {
             $this->Owner->{$date} = '';
         } else {
             $this->Owner->{$date} = $_dt;
         }
     }
     return parent::afterFind($event);
 }
开发者ID:ema394,项目名称:gestionale,代码行数:18,代码来源:myDateFormat.php

示例6: afterFind

 public function afterFind($event)
 {
     foreach ($this->attributes as $attribute => $format) {
         if (!$this->owner->hasAttribute($attribute)) {
             continue;
         }
         $format = $format == null ? self::FORMAT_DEFAULT : $format;
         if ($this->owner->getAttribute($attribute) == '0') {
             $this->attributes[$attribute] = $this->emptyMark;
         } else {
             $this->attributes[$attribute] = Yii::app()->dateFormatter->format($format, $this->owner->getAttribute($attribute));
         }
     }
     $this->owner->setAttributes($this->attributes);
     parent::afterFind($event);
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:16,代码来源:DateFormatBehavior.php

示例7: afterFind

 /**
  * Provides creating related HAS_ONE records in memory.
  * 
  * @param CEvent $event event object
  * 
  * @see CActiveRecordBehavior::afterFind()
  *
  * @throws Exception
  */
 public function afterFind($event)
 {
     $owner = $this->getOwner();
     foreach ($owner->relations() as $key => $relation) {
         $isHasOne = $relation['0'] == CActiveRecord::HAS_ONE;
         if (!$isHasOne) {
             continue;
         }
         if (isset($this->relations[$key]) || in_array($key, $this->relations)) {
             $config = $this->_getRelationConfig($key);
             if ($config['createRelated']) {
                 $criteria = new CDbCriteria();
                 $parameters = array_slice($relation, self::RELATION_REQUIRED_PARAMS_COUNT);
                 foreach ($parameters as $name => $value) {
                     $name = $name == 'on' ? 'condition' : $name;
                     $criteria->{$name} = $value;
                 }
                 $criteria->compare($relation[2], $owner->primaryKey);
                 $model = CActiveRecord::model($relation[1]);
                 if (!$model->exists($criteria)) {
                     $related = new $relation[1]();
                     $related->{$relation}[2] = $owner->primaryKey;
                     if ($config['insertIfNotExists']) {
                         if (!$related->save(false)) {
                             $message = 'Can not save related record. ' . CHtml::errorSummary($related);
                             throw new CException($message);
                         }
                     }
                     $this->owner->addRelatedRecord($key, $related, false);
                 }
             }
         }
     }
     parent::afterFind($event);
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:44,代码来源:CHasOneBehavior.php

示例8: afterFind

 public function afterFind($event)
 {
     if ($this->owner->findMode === TActiveRecord::FIND_ONE) {
         foreach ($this->config as $item) {
             $prefix = $item['prefix'];
             $type = $item['type'];
             $privArray = $this->getPriv($type);
             foreach ($privArray as $scope => $value) {
                 $this->owner->{$prefix . $scope} = $value;
             }
         }
     }
     parent::afterFind($event);
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:14,代码来源:DataPrivBehavior.php

示例9: afterFind

 public function afterFind($event)
 {
     // Save old values
     $this->setOldAttributes($this->Owner->getAttributes());
     return parent::afterFind($event);
 }
开发者ID:romeo14,项目名称:pow,代码行数:6,代码来源:LoggableBehavior.php

示例10: afterFind

 /**
  * Actions to be performed after the model is loaded
  */
 public function afterFind($event)
 {
     $this->_dbAttributes = $this->owner->getAttributes();
     parent::afterFind($event);
 }
开发者ID:cornernote,项目名称:yii-embed-wordpress,代码行数:8,代码来源:AuditFieldBehavior.php

示例11: afterFind

 /**
  * Load status after find model.
  * @param CEvent
  */
 public function afterFind($event)
 {
     $this->_status = $this->getOwner()->getAttribute($this->statusField);
     $this->_statusText = isset($this->statuses[$this->_status]) ? $this->statuses[$this->_status] : 'unknown';
     parent::afterFind($event);
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:10,代码来源:EStatusBehavior.php

示例12: afterFind

 public function afterFind($event)
 {
     $this->setOldAttributes($this->getOwner()->getAttributes());
     return parent::afterFind($event);
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:5,代码来源:LoggableBehavior.php

示例13: afterFind

 /**
  * Apply object translation
  */
 public function afterFind($event)
 {
     if (!$this->disableEvents) {
         $this->applyTranslation();
     }
     return parent::afterFind($event);
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:10,代码来源:TranslateBehavior.php

示例14: afterFind

 /**
  * Apply object translation
  */
 public function afterFind($event)
 {
     $this->_oldTags = $this->getOwner()->tags;
     return parent::afterFind($event);
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:TagsBehavior.php

示例15: afterFind

 /**
  * @param CEvent $event
  */
 public function afterFind($event)
 {
     $this->_convertAttributesFromDB();
     parent::afterFind($event);
 }
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:8,代码来源:TransformAttributesBehavior.php


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