yii2-activerecord-inheritance icon indicating copy to clipboard operation
yii2-activerecord-inheritance copied to clipboard

getAttributes not work correctly with multiple levels of inheritance

Open ddanielroche opened this issue 8 years ago • 0 comments

Hi @jlorente,

Testing your trait with cascading inheritance, getAttributes not work correctly. In this case only returns the values of the attributes of the model and model parent. Grandparent attributes are null.

I propose the following implementation to fix:

public function getAttributes($names = null, $except = []) {
    return array_merge($this->_parent()->getAttributes($names, $except), parent::getAttributes($names, $except));
}

regards...

ddanielroche avatar Aug 17 '16 16:08 ddanielroche