Skip to content

getAttributes not work correctly with multiple levels of inheritance #10

@ddanielroche

Description

@ddanielroche

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions