mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-23 04:00:23 +08:00
forgot to remove strtolower from __get and __unset
This commit is contained in:
@ -379,13 +379,12 @@ class ActiveRecord extends Model
|
|||||||
} elseif ($this->hasAttribute($name)) {
|
} elseif ($this->hasAttribute($name)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
$t = strtolower($name);
|
if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
|
||||||
if (isset($this->_related[$t]) || array_key_exists($t, $this->_related)) {
|
return $this->_related[$name];
|
||||||
return $this->_related[$t];
|
|
||||||
}
|
}
|
||||||
$value = parent::__get($name);
|
$value = parent::__get($name);
|
||||||
if ($value instanceof ActiveRelation) {
|
if ($value instanceof ActiveRelation) {
|
||||||
return $this->_related[$t] = $value->multiple ? $value->all() : $value->one();
|
return $this->_related[$name] = $value->multiple ? $value->all() : $value->one();
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
@ -433,9 +432,8 @@ class ActiveRecord extends Model
|
|||||||
if ($this->hasAttribute($name)) {
|
if ($this->hasAttribute($name)) {
|
||||||
unset($this->_attributes[$name]);
|
unset($this->_attributes[$name]);
|
||||||
} else {
|
} else {
|
||||||
$t = strtolower($name);
|
if (isset($this->_related[$name])) {
|
||||||
if (isset($this->_related[$t])) {
|
unset($this->_related[$name]);
|
||||||
unset($this->_related[$t]);
|
|
||||||
} else {
|
} else {
|
||||||
parent::__unset($name);
|
parent::__unset($name);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user