yii2-activerecord-inheritance
yii2-activerecord-inheritance copied to clipboard
getAttributes not work correctly with multiple levels of inheritance
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...