public function hierarchy($prefix = '', &$ignore = [], $index = false)
    {
        $hash = spl_object_hash($this);
        if (isset($ignore[$hash])) {
            return false;
        }
        $ignore[$hash] = true;

        $result = [];

        foreach ($this as $entity) {
            if ($hierarchy = $entity->hierarchy($prefix, $ignore, true)) {
                $result += $hierarchy;
            }
        }

        return $index ? $result : array_keys($result);
    }
public function hierarchy($prefix = '', &$ignore = [], $index = false)
    {
        $hash = spl_object_hash($this);
        if (isset($ignore[$hash])) {
            return false;
        }
        $ignore[$hash] = true;

        $result = [];

        foreach ($this as $entity) {
            if ($hierarchy = $entity->hierarchy($prefix, $ignore, true)) {
                $result += $hierarchy;
            }
        }

        return $index ? $result : array_keys($result);
    }
public function hierarchy ( $ prefix = '' , & $ ignore = [ ] , $ index = false ) { $ hash = spl_object_hash ( $ this ) ; if ( isset ( $ ignore [ $ hash ] ) ) { return false ; } $ ignore [ $ hash ] = true ; $ result = [ ] ; foreach ( $ this as $ entity ) { if ( $ hierarchy = $ entity -> hierarchy ( $ prefix , $ ignore , true ) ) { $ result += $ hierarchy ; } } return $ index ? $ result : array_keys ( $ result ) ; }
Returns an array of all external relations and nested relations names.

@param  string      $prefix The parent relation path.
@param  array       $ignore The already processed entities to ignore (address circular dependencies).
@param  boolean     $index  Returns an indexed array or not.
@return array|false         Returns an array of relation names or `false` when a circular loop is reached.
Returns an array of all external relations and nested relations names .