getCollection.

@param RepositoryInterface $repository
@param callable|null       $comparator

@return LinkedVersions
969309
protected function getCollection(RepositoryInterface $repository, callable $comparator = null)
    {
        $versions = $repository->fetchAll();
        if ($comparator) {
            $versions->sortWith($comparator);
        }

        return $versions;
    }
789817
protected function getRepositoryUrl($repositoryId, $selector = null)
    {
        $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);

        if ($result === null) {
            $this->getRepositoriesInternal($repositoryId);
            $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);
        }

        if ($result === null) {
            throw new CmisObjectNotFoundException(
                sprintf(
                    'Unknown repository! Repository: "%s" | Selector: "%s"',
                    $repositoryId,
                    $selector
                )
            );
        }

        return $result;
    }
810415
public function sorted(callable $comparator = null): Map
    {
        $copy = $this->copy();
        $copy->sort($comparator);
        return $copy;
    }
665367
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        $columnName = $this->columnName;

        if (self::canFilter($collection, $repository, $columnName)) {
            $aliases = $collection->getPulledUpAggregatedColumns();
            $isAlias = in_array($columnName, $aliases);

            $columnName = self::getRealColumnName($this, $collection);
            $toAlias = self::getTableAlias($this, $collection);

            if (count($this->oneOf) == 0) {
                // When a one of has nothing to filter - it should return no matches, rather than all matches.
                $whereExpressionCollector->addWhereExpression(
                    new LiteralWhereExpression("1=0")
                );

                return true;
            }

            $oneOfParams = [];
            $paramName = uniqid() . $columnName;

            foreach ($this->oneOf as $key => $oneOf) {
                $key = preg_replace("/[^[:alnum:]]/", "", $key) . '_';
                $params[$paramName . $key] = $oneOf;
                $oneOfParams[] = ':' . $paramName . $key;
            }

            $whereExpressionCollector->addWhereExpression(new ColumnWhereExpression($columnName, " IN ( " . implode(", ", $oneOfParams) . " )", $isAlias, $toAlias));

            return true;
        }

        return false;
    }
646463
public function relatedItem($resourceModel, $relatedId, RelatedRepository $repository)
    {
        if ($repository instanceof JsonApiRepository) {
            $this->applyFilters($this->filters, $this->filterFactory, $repository);
        }

        return $repository->findRelated($resourceModel, $relatedId);
    }
424699
public function collection(
        ResourceManager $resourceManager,
        ApiRequest $request,
        int $version,
        string $resource
    )
    {
        $resourceManager->version($version);

        /** @var HandlesCollectionRequest $handler */
        $handler = $this->initializeHandler($resourceManager, $resource, $request, HandlesCollectionRequest::class);

        $parameters = $request->asParameters();

        $repository = $this->initializeRepository($resourceManager, $resource, $parameters);

        $result = $handler->index($repository, $parameters);

        $document = $this->makeDocumentFromCollection($resourceManager, $resource, $result, $parameters, $handler);

        return $this->respond($document);
    }
320644
public function getCollection(string $resourceClass, string $operationName = null, array $context = [])
    {
        /** @var ObjectManager $manager */
        $manager = $this->managerRegistry->getManagerForClass($resourceClass);

        $repository = $manager->getRepository($resourceClass);
        if (!method_exists($repository, 'createQueryBuilder')) {
            throw new RuntimeException('The repository class must have a "createQueryBuilder" method.');
        }

        $queryBuilder = $repository->createQueryBuilder('o');
        $queryNameGenerator = new QueryNameGenerator();
        foreach ($this->collectionExtensions as $extension) {
            $extension->applyToCollection($queryBuilder, $queryNameGenerator, $resourceClass, $operationName, $context);

            if ($extension instanceof QueryResultCollectionExtensionInterface && $extension->supportsResult($resourceClass, $operationName, $context)) {
                return $extension->getResult($queryBuilder, $resourceClass, $operationName, $context);
            }
        }

        return $queryBuilder->getQuery()->getResult();
    }
1089939
public function getCollectionForItem(ItemInterface $item)
    {
        foreach ($this->colectionItemCollection as $name => $collection) {
            $itemPath = $item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE).'/';
            $collectionPath = $collection->getPath().'/';

            if (strpos($itemPath, $collectionPath) === 0) {
                return $collection;
            }
        }

        return $this->colectionItemCollection->get('pages');
    }
996268
public function getObjectsByCollection(CollectionInterface $collection)
    {
        $objects = array();
        $that = $this;
        $bucketName = $this->bucketName;
        $keyPrefix = $this->keyPrefix;
        $bucket = $this->getCurrentBucket();

        foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
            /** @var \Neos\Flow\ResourceManagement\PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setStream(function () use ($that, $bucketName, $keyPrefix, $bucket, $resource) {
                $stream = $bucket->object($keyPrefix . $resource->getSha1())->downloadAsStream();
                return StreamWrapper::getResource($stream);
            });
            $objects[] = $object;
        }

        return $objects;
    }
57203
public function findAll(): OptionCollection
    {
        $options = [];

        foreach ($this->repositories as $repository) {
            array_push($options, ...$repository->findAll());
        }

        return new OptionCollection\ArrayOptionCollection($options);
    }
679522
public function getRepository($className = null){
      if($className === null){
        $repo = $this->getRepository(static::REPOSITORY_NAMESPACE);
      }else{
        $repo = $this->getEntityManager()->getRepository($className);
      }
      return $repo;
    }
1274846
public function relatedCollection($resourceModel, RelatedRepository $repository)
    {
        if ($repository instanceof ConditionAwareRepository) {
            $this->applyFilters($this->filters, $this->filterFactory, $repository);
        }

        if ($repository instanceof OneToOneRelationRepository) {
            return $repository->getOne($resourceModel);
        }

        if ($repository instanceof OneToManyRelationRepository) {
            return $repository->getMany($resourceModel);
        }

        throw new \InvalidArgumentException('Repository ' . get_class($repository) . ' has no relation repository interface defined.');
    }
892103
protected function getCollection(EnvironmentInterface $environment)
    {
        $dataDefinition = $environment->getDataDefinition();
        $relationShip   = $dataDefinition->getModelRelationshipDefinition();

        if (!$relationShip->getChildCondition($dataDefinition->getName(), $dataDefinition->getName())) {
            return $this->getFlatCollection($environment);
        }

        return $this->getHierarchyCollection($this->getClipboardItems($environment), $environment);
    }
963758
protected function getRepositoriesInternal($repositoryId = null)
    {
        $repositoryUrlCache = $this->getRepositoryUrlCache();

        if ($repositoryId === null) {
            // no repository id provided -> get all
            $url = $repositoryUrlCache->buildUrl($this->getServiceUrl());
        } else {
            // use URL of the specified repository
            $url = $repositoryUrlCache->getRepositoryUrl($repositoryId, Constants::SELECTOR_REPOSITORY_INFO) ??
                $repositoryUrlCache->buildUrl($this->getServiceUrl());
        }

        $repositoryInfos = [];
        $result = $this->readJson($url);
        if (!is_array($result)) {
            throw new CmisConnectionException(
                'Could not fetch repository info! Response is not a valid JSON.',
                1416343166
            );
        }
        foreach ($result as $item) {
            if (is_array($item)) {
                $repositoryInfo = $this->getJsonConverter()->convertRepositoryInfo($item);

                if ($repositoryInfo instanceof RepositoryInfoBrowserBinding) {
                    $id = $repositoryInfo->getId();
                    $repositoryUrl = $repositoryInfo->getRepositoryUrl();
                    $rootUrl = $repositoryInfo->getRootUrl();

                    if (empty($id) || empty($repositoryUrl) || empty($rootUrl)) {
                        throw new CmisConnectionException(
                            sprintf('Found invalid Repository Info! (id: %s)', $id),
                            1415187765
                        );
                    }

                    $this->getRepositoryUrlCache()->addRepository($id, $repositoryUrl, $rootUrl);

                    $repositoryInfos[] = $repositoryInfo;
                }
            } else {
                throw new CmisConnectionException(
                    sprintf(
                        'Found invalid repository info! Value of type "array" was expected'
                        . 'but value of type "%s" was given.',
                        gettype($item)
                    ),
                    1415187764
                );
            }
        }

        return $repositoryInfos;
    }
1374121
public function unique(callable $comparator = null)
    {
        if (!$comparator) {
            $this->source = array_values(array_unique($this->source));
        }

        return $this;
    }
585297
public function getRepositoryEntities($repository)
    {
        if (!isset($this->_repository_entities[$repository])) {
            $this->_repository_entities[$repository] =
                $this->getService('anahita:domain.entityset', array('repository' => $this));
        }

        return $this->_repository_entities[$repository];
    }
1200837
public function getConditionByType(string $repositoryType) : Collection
    {
        return $this->conditions->filter(function (RepositoryCondition $condition) use ($repositoryType) {
            return $condition instanceof $repositoryType;
        });
    }