本文整理汇总了PHP中CFormModel::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::__get方法的具体用法?PHP CFormModel::__get怎么用?PHP CFormModel::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormModel
的用法示例。
在下文中一共展示了CFormModel::__get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Override to handle use case of $name == 'id'.
* As this form does not have an 'id', it will return null;
* @see ModelElement. This form is used by ModelElement for example
* and ModelElement expects the model to have an 'id' value.
*/
public function __get($name)
{
if ($name == 'id') {
return null;
}
return parent::__get($name);
}
示例2: __get
public function __get($name)
{
if (Yii::app()->user->data->hasAttribute($name)) {
return Yii::app()->user->data->{$name};
}
return parent::__get($name);
}
示例3: __get
public function __get($name)
{
if (isset($this->_data[$name])) {
return $this->_data[$name];
}
return parent::__get($name);
}
示例4: __get
public function __get($name)
{
if (isset($this->_properties[$name])) {
return $this->_properties[$name];
} else {
return parent::__get($name);
}
}
示例5: __get
public function __get($attribute)
{
if (in_array($attribute, array_keys($this->_fields))) {
return $this->_fields[$attribute];
} else {
return parent::__get($attribute);
}
}
示例6: __get
public function __get($name)
{
if (isset($this->dynAttributes[$name])) {
return $this->dynAttributes[$name];
} else {
return parent::__get($name);
}
}
示例7: __get
public function __get($name)
{
if (isset($this->_params[$name])) {
if (isset($this->_params[$name]['value'])) {
return $this->_params[$name]['value'];
}
return isset($this->_params[$name]['default']) ? $this->_params[$name]['default'] : null;
}
return parent::__get($name);
}
示例8: __get
/**
* A special getter to get 'value[0]' or 'value[str]' attributes and so on.
* @see CComponent::__get()
*/
public function __get($name)
{
if (($pos = strrpos($name, '[')) !== false) {
$subname = substr($name, 0, $pos);
$posn = strpos($name, ']', $pos);
$value = $this->{$subname};
return $value[substr($name, $pos + 1, $posn - $pos - 1)];
}
return parent::__get($name);
}
示例9: __get
public function __get($name)
{
switch (true) {
case isset($this->__tempVar[$name]):
return $this->__tempVar;
break;
default:
return parent::__get($name);
break;
}
}
示例10: __get
/**
* Overload the __getter so that it checks for data in the following order
* 1) Pull From db/cache (Cii::getConfig now does caching of elements for improved performance)
* 2) Check for __protected__ property, which we consider the default vlaue
* 3) parent::__get()
*
* In order for this to work with __default__ values, the properties in classes that extend from this
* MUST be protected. If they are public it will bypass this behavior.
*
* @param mixed $name The variable name we want to retrieve from the calling class
* @return mixed
*/
public function __get($name)
{
$data = Cii::getConfig($name);
if ($data !== NULL && $data !== "" && !isset($this->attributes[$name])) {
return $data;
}
if (property_exists($this, $name)) {
return $this->{$name};
}
return parent::__get($name);
}
示例11: __get
/**
* __get
* @param string $name
* @return mixed|null|void
*/
public function __get($name)
{
if (isset($this->_dynamicFields[$name])) {
if (!empty($this->_dynamicData[$name])) {
return $this->_dynamicData[$name];
}
return $this->_dynamicFields[$name];
} else {
return parent::__get($name);
}
}
示例12: __get
public function __get($name)
{
try {
parent::__get($name);
} catch (CException $exception) {
list($settingName, $type) = UserNotificationUtil::getSettingNameAndTypeBySuffixedConfigurationAttribute($name);
if (isset($this->inboxAndEmailNotificationSettings[$settingName][$type])) {
return $this->inboxAndEmailNotificationSettings[$settingName][$type];
}
return null;
}
}
示例13: __get
public function __get($name)
{
$module = Yii::app()->controller->module;
switch ($name) {
case $module->userIdColumn:
return $this->_id;
case $module->userNameColumn:
return $this->_name;
default:
return parent::__get($name);
}
}
示例14: __get
public function __get($name)
{
$vars = get_class_vars(get_class($this));
if (array_key_exists($name, $vars)) {
return $this->{$name};
} else {
try {
return parent::__get($name);
} catch (Exception $e) {
return null;
}
}
}
示例15: __get
/**
* PHP getter magic method.
* This method is overridden so that any attribute can be accessed.
* @param string $name the property name or event name
* @return mixed the property value, event handlers attached to the event, or the named behavior
* @throws CException if the property or event is not defined
* @see __set
*/
public function __get($name)
{
try {
return parent::__get($name);
} catch (Exception $e) {
if (isset($this->_attributes[$name])) {
return $this->_attributes[$name];
}
if (isset($_POST['YdActiveFormModel'][$name])) {
return $this->_attributes[$name] = $_POST['YdActiveFormModel'][$name];
}
return null;
}
}