/** * 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); } }
public function __get($name) { if ($groupName = $this->groupName($name)) { return $this->getGroupLabels($groupName); } else { return parent::__get($name); } }
public function __get($name) { try { return parent::__get($name); } catch (CException $ex) { if ($this->hasEavAttribute($name)) { return $this->getEavAttribute($name); } else { throw $ex; } } }
/** * 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); }
/** * 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 ''; }
/** * 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); }