mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fixed canGetProperty() and canSetProperty() returns false for yii\db\BaseActiveRecord attributes
This commit is contained in:
@ -230,6 +230,28 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
|
||||
{
|
||||
if ($this->hasAttribute($name)) {
|
||||
return true;
|
||||
}
|
||||
return parent::canGetProperty($name, $checkVars, $checkBehaviors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function canSetProperty($name, $checkVars = true, $checkBehaviors = true)
|
||||
{
|
||||
if ($this->hasAttribute($name)) {
|
||||
return true;
|
||||
}
|
||||
return parent::canSetProperty($name, $checkVars, $checkBehaviors);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP getter magic method.
|
||||
* This method is overridden so that attributes and related objects can be accessed like properties.
|
||||
|
||||
Reference in New Issue
Block a user