public function getAllParents()
    {
        $closestParents = $this->getParents();

        $allParents = [];

        foreach ($closestParents as $parent) {
            $allParents = array_merge(
                $allParents,
                $parent->getAllParents()
            );
        }

        $allParents = array_unique(
            array_merge(
                $allParents,
                $closestParents->toArray()
            )
        );

        return $allParents;
    }
public function getAllParents()
    {
        $closestParents = $this->getParents();

        $allParents = [];

        foreach ($closestParents as $parent) {
            $allParents = array_merge(
                $allParents,
                $parent->getAllParents()
            );
        }

        $allParents = array_unique(
            array_merge(
                $allParents,
                $closestParents->toArray()
            )
        );

        return $allParents;
    }
public function getAllParents ( ) { $ closestParents = $ this -> getParents ( ) ; $ allParents = [ ] ; foreach ( $ closestParents as $ parent ) { $ allParents = array_merge ( $ allParents , $ parent -> getAllParents ( ) ) ; } $ allParents = array_unique ( array_merge ( $ allParents , $ closestParents -> toArray ( ) ) ) ; return $ allParents ; }
Get all the parents.

@return array All parents
Get all the parents .