src/Model/ModelUtil.php
public function findParentsRecursively(string $parentProperty, string $table, Model $instance): array
    {
        $parents = [];

        if (!$instance->{$parentProperty} || null === ($parentInstance = $this->findModelInstanceByPk($table, $instance->{$parentProperty}))) {
            return $parents;
        }

        return array_merge($this->findParentsRecursively($parentProperty, $table, $parentInstance), [$parentInstance]);
    }
public function findParentsRecursively(string $parentProperty, string $table, Model $instance): array
    {
        $parents = [];

        if (!$instance->{$parentProperty} || null === ($parentInstance = $this->findModelInstanceByPk($table, $instance->{$parentProperty}))) {
            return $parents;
        }

        return array_merge($this->findParentsRecursively($parentProperty, $table, $parentInstance), [$parentInstance]);
    }
public function findParentsRecursively ( string $ parentProperty , string $ table , Model $ instance ) : array { $ parents = [ ] ; if ( ! $ instance -> { $ parentProperty } || null === ( $ parentInstance = $ this -> findModelInstanceByPk ( $ table , $ instance -> { $ parentProperty } ) ) ) { return $ parents ; } return array_merge ( $ this -> findParentsRecursively ( $ parentProperty , $ table , $ parentInstance ) , [ $ parentInstance ] ) ; }
Returns an array of a model instance's parents in ascending order, i.e. the root parent comes first.

@param string $parentProperty
@param string $table
@param Model  $instance

@return array
Returns an array of a model instance s parents in ascending order i . e . the root parent comes first .