Sulu\Bundle\MediaBundle\Entity\CollectionRepositoryInterface::findCollections PHP Method

findCollections() public method

finds all collections, can be filtered with parent and depth.
public findCollections ( array $filter = [], integer $limit = null, integer $offset = null, array $sortBy = [] ) : Collection[]
$filter array
$limit integer
$offset integer
$sortBy array sort by e.g. array('title' => 'ASC')
return Collection[]
    public function findCollections($filter = [], $limit = null, $offset = null, $sortBy = []);

Usage Example

Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function get($locale, $filter = [], $limit = null, $offset = null, $sortBy = [])
 {
     $collectionEntities = $this->collectionRepository->findCollections($filter, $limit, $offset, $sortBy);
     $this->count = $collectionEntities instanceof Paginator ? $collectionEntities->count() : count($collectionEntities);
     $collections = [];
     foreach ($collectionEntities as $entity) {
         $collections[] = $this->getApiEntity($entity, $locale);
     }
     return $collections;
 }