Sulu\Bundle\MediaBundle\Collection\Manager\CollectionManager::getTree PHP Method

getTree() public method

public getTree ( $locale, $offset, $limit, $search, $depth, $sortBy = [], $systemCollections = true )
    public function getTree($locale, $offset, $limit, $search, $depth = 0, $sortBy = [], $systemCollections = true)
    {
        $filter = ['offset' => $offset, 'limit' => $limit, 'search' => $search, 'locale' => $locale, 'systemCollections' => $systemCollections];
        /** @var CollectionEntity[] $entities */
        $entities = $this->collectionRepository->findCollectionSet($depth, $filter, null, $sortBy, $this->getCurrentUser(), $this->permissions[PermissionTypes::VIEW]);
        $collections = [];
        foreach ($entities as $entity) {
            if ($entity->getParent() === null) {
                $collections[] = $this->getApiEntity($entity, $locale, $entities);
            }
        }
        unset($filter['limit']);
        unset($filter['offset']);
        $this->count = $this->collectionRepository->count($depth, $filter);
        return $collections;
    }