Sulu\Bundle\MediaBundle\Collection\Manager\CollectionManagerInterface::getById PHP Method

getById() public method

Returns a collection with a given id.
public getById ( integer $id, integer $locale, integer $depth, boolean $breadcrumb = false, array $filter = [], array $sortBy = [] ) : Collection
$id integer the id of the collection
$locale integer the locale which the collection should be return
$depth integer if depth > 1 children will returned also
$breadcrumb boolean if true breadcrumb will be appended
$filter array array of criteria
$sortBy array fields to sort by
return Sulu\Bundle\MediaBundle\Api\Collection
    public function getById($id, $locale, $depth = 0, $breadcrumb = false, $filter = [], $sortBy = []);

Usage Example

示例#1
0
 /**
  * {@inheritdoc}
  */
 public function resolveDatasource($datasource, array $propertyParameter, array $options)
 {
     if (empty($datasource)) {
         return;
     }
     if ($datasource === 'root') {
         $title = 'smart-content.media.all-collections';
         return new DatasourceItem('root', $title, $title);
     }
     $entity = $this->collectionManager->getById($datasource, $options['locale']);
     return new DatasourceItem($entity->getId(), $entity->getTitle(), $entity->getTitle());
 }