本文整理汇总了PHP中ActiveRecord::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::__get方法的具体用法?PHP ActiveRecord::__get怎么用?PHP ActiveRecord::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::__get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
function __get($key)
{
if ($key == "id") {
return $this->user_id;
}
return ActiveRecord::__get($key);
}
示例2: __get
public function __get($name)
{
try {
return parent::__get($name);
} catch (Exception $e) {
}
}
示例3: __get
public function __get($name)
{
if (in_array($name, $this->i18n())) {
$attr = Yii::app()->language . '_' . $name;
return $this->{$attr};
} else {
return parent::__get($name);
}
}
示例4: __get
/**
* PHP getter magic method.
* This method is overridden so that AR attributes can be accessed like properties.
* @param string $name property name
* @return mixed property value
* @see getAttribute
*/
public function __get($name)
{
if ($this->_isMultilingualAttribute($name) && !$this->isNew) {
$this->_loadMultilingualAttribute($name);
}
return parent::__get($name);
}
示例5: __get
/**
* Allows to access EAV attributes like normal model attrs.
* e.g $model->eav_some_attribute_name
*
* @todo Optimize, cache.
* @param $name
* @return null
*/
public function __get($name)
{
if (substr($name, 0, 4) === 'eav_') {
if ($this->getIsNewRecord()) {
return null;
}
$attribute = substr($name, 4);
$eavData = $this->getEavAttributes();
if (isset($eavData[$attribute])) {
$value = $eavData[$attribute];
} else {
return null;
}
$attributeModel = ShopAttribute::model()->findByAttributes(array('name' => $attribute));
return $attributeModel->renderValue($value);
}
return parent::__get($name);
}
示例6: __get
public function __get($name)
{
if ($name == "title") {
return $this->languageSettings[0]->surveyls_title;
} elseif ($name == "id") {
return $this->sid;
}
return parent::__get($name);
}