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


PHP CActiveRecordBehavior::__get方法代码示例

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


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

示例1: __get

 /**
  * Make translated attributes readable, with and without suffix
  */
 public function __get($name)
 {
     if (!$this->handlesProperty($name)) {
         return parent::__get($name);
     }
     if (in_array($name, $this->translationAttributes)) {
         // Without suffix
         $lang = Yii::app()->language;
         $withoutSuffix = $name;
     } else {
         // With suffix
         $lang = $this->getLanguageSuffix($name);
         $withoutSuffix = $this->getOriginalAttribute($name);
     }
     $withSuffix = $withoutSuffix . '_' . $lang;
     if (in_array($withoutSuffix, $this->translationAttributes)) {
         if (isset($this->dirtyAttributes[$withSuffix])) {
             return $this->dirtyAttributes[$withSuffix];
         }
         if ($lang == Yii::app()->sourceLanguage) {
             $sourceMessageAttribute = "_" . $withoutSuffix;
             $sourceMessageContent = $this->owner->attributes[$sourceMessageAttribute];
             return $sourceMessageContent;
         }
         if (is_null($this->getSourceMessage($withoutSuffix))) {
             return null;
         }
         return Yii::t($this->getCategory($withoutSuffix), $this->getSourceMessage($withoutSuffix), array(), $this->messageSourceComponent, $lang);
     }
 }
开发者ID:neam,项目名称:yii-i18n-attribute-messages,代码行数:33,代码来源:I18nAttributeMessagesBehavior.php

示例2: __get

 public function __get($name)
 {
     if ($groupName = $this->groupName($name)) {
         return $this->getGroupLabels($groupName);
     } else {
         return parent::__get($name);
     }
 }
开发者ID:urmaul,项目名称:yii-enumattributes,代码行数:8,代码来源:EnumAttributesBehavior.php

示例3: __get

 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (CException $ex) {
         if ($this->hasEavAttribute($name)) {
             return $this->getEavAttribute($name);
         } else {
             throw $ex;
         }
     }
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:12,代码来源:EavBehavior.php

示例4: __get

 /**
  * Make translated attributes readable without requiring suffix
  */
 public function __get($name)
 {
     if (!in_array($name, $this->translationAttributes) && !in_array($name, array_keys($this->multilingualRelations))) {
         return parent::__get($name);
     }
     $translatedAttribute = $name . '_' . Yii::app()->language;
     if (array_key_exists($translatedAttribute, $this->owner->attributes)) {
         return $this->owner->{$translatedAttribute};
     }
     $translatedRelation = $this->generateRelationName($this->multilingualRelations[$name] . '_' . Yii::app()->language);
     if (array_key_exists($translatedRelation, $this->owner->relations())) {
         return $this->owner->{$translatedRelation};
     }
     return parent::__get($name);
 }
开发者ID:neam,项目名称:yii-i18n-columns,代码行数:18,代码来源:I18nColumnsBehavior.php

示例5: __get

 /**
  * Make translated attributes readable
  */
 public function __get($name)
 {
     if (!in_array($name, $this->translationAttributes)) {
         return parent::__get($name);
     }
     if (!$this->disableTranslationModel) {
         $model = $this->getTranslationModel();
         if (!empty($model->{$name})) {
             return $model->{$name};
         }
     }
     if ($this->_fbModel !== null && !empty($this->_fbModel->{$name})) {
         return $this->_fbModel->{$name};
     }
     if (isset($this->fallbackColumns[$name])) {
         return $this->owner->{$this->fallbackColumns[$name]};
     }
     return '';
 }
开发者ID:mikehaertl,项目名称:translatable,代码行数:22,代码来源:Translatable.php

示例6: __get

 /**
  * The magic getter, enables resources to be accessed like properties
  * @param string $name The name of the virtual property
  */
 public function __get($name)
 {
     if (isset($this->attributes[$name])) {
         if ($this->attributes[$name]->multiple) {
             return $this->attributes[$name]->resources;
         } else {
             $resources = $this->attributes[$name]->resources;
             return array_shift($resources);
         }
     }
     return parent::__get($name);
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:16,代码来源:AResourceful.php


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