public function getParents(LoaderInterface $loader = null)
    {
        if (empty($this->parents) && $this->id !== static::$root)
            $this->parents = [$this->getRoot()];

        $acl = $this->getACL();
        if (null === $acl)
            throw new \RuntimeException("ACL is null on " . get_class($this));
        $parents = [];
        $ids = array_keys($this->parents);
        foreach ($ids as $id)
        {
            if ($this->parents[$id] === null)
            {
                if (!$acl->hasInstance(static::class, $id) && $loader !== null)
                {
                    $parent = $loader->load($id, static::class);
                    $acl->setInstance($parent);
                    $this->parents[$id] = $parent;
                }
                else
                {
                    $this->parents[$id] = $acl->getInstance(static::class, $id);
                }
            }
            $parents[] = $this->parents[$id];
        }
        return $parents;
    }
public function getParents(LoaderInterface $loader = null)
    {
        if (empty($this->parents) && $this->id !== static::$root)
            $this->parents = [$this->getRoot()];

        $acl = $this->getACL();
        if (null === $acl)
            throw new \RuntimeException("ACL is null on " . get_class($this));
        $parents = [];
        $ids = array_keys($this->parents);
        foreach ($ids as $id)
        {
            if ($this->parents[$id] === null)
            {
                if (!$acl->hasInstance(static::class, $id) && $loader !== null)
                {
                    $parent = $loader->load($id, static::class);
                    $acl->setInstance($parent);
                    $this->parents[$id] = $parent;
                }
                else
                {
                    $this->parents[$id] = $acl->getInstance(static::class, $id);
                }
            }
            $parents[] = $this->parents[$id];
        }
        return $parents;
    }
public function getParents ( LoaderInterface $ loader = null ) { if ( empty ( $ this -> parents ) && $ this -> id !== static :: $ root ) $ this -> parents = [ $ this -> getRoot ( ) ] ; $ acl = $ this -> getACL ( ) ; if ( null === $ acl ) throw new \ RuntimeException ( "ACL is null on " . get_class ( $ this ) ) ; $ parents = [ ] ; $ ids = array_keys ( $ this -> parents ) ; foreach ( $ ids as $ id ) { if ( $ this -> parents [ $ id ] === null ) { if ( ! $ acl -> hasInstance ( static :: class , $ id ) && $ loader !== null ) { $ parent = $ loader -> load ( $ id , static :: class ) ; $ acl -> setInstance ( $ parent ) ; $ this -> parents [ $ id ] = $ parent ; } else { $ this -> parents [ $ id ] = $ acl -> getInstance ( static :: class , $ id ) ; } } $ parents [ ] = $ this -> parents [ $ id ] ; } return $ parents ; }
Return a list of all parent elements of this element

@param $loader LoaderInterface A loader that can be used to load additional instances
@return array An array of all parent elements
Return a list of all parent elements of this element