/**
* {@inheritdoc}
*/
public function getTree($locale, $offset, $limit, $search, $depth = 0, $sortBy = [])
{
/** @var Paginator $collectionSet */
$collectionSet = $this->collectionRepository->findCollectionSet($depth, ['offset' => $offset, 'limit' => $limit, 'search' => $search, 'locale' => $locale], null, $sortBy);
$collections = [];
/** @var CollectionEntity[] $entities */
$entities = iterator_to_array($collectionSet);
foreach ($entities as $entity) {
if ($entity->getParent() === null) {
$collections[] = $this->getApiEntity($entity, $locale, $entities);
}
}
$this->count = $collectionSet->count();
return $collections;
}