@param string $documentClass

@return Repository
331363
public function getRepository(string $documentClass): Repository
    {
        $metadata = $this->getMetadata($documentClass);
        if ($metadata->isNested()) {
            throw new InvalidArgumentException(
                sprintf('Cannot get repository for nested document class "%s".', $documentClass)
            );
        }

        return $this->repositoryFactory->getRepository($this, $documentClass);
    }
373656
public function getCollectionByDocumentClass($documentClass): Collection
    {
        $metadata = $this->metadataFactory->getClassMetadata($documentClass);

        return $this->getCollection($metadata->getCollectionName(), $metadata->getCollectionOptions());
    }
362688
private function getClass($objectOrClass)
    {
        $class = is_object($objectOrClass) ? ClassUtils::getClass($objectOrClass) : $objectOrClass;

        return isset($this->entityOverride[$class]) ? $this->entityOverride[$class] : $class;
    }
989946
public function getHydrator($class)
    {
        $metadata = $this->classMetadataFactory->getMetadataForClass($class);
        return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
    }
596871
protected function getObjectRepository(string $entityNamespace): ? ObjectRepository
    {
        return $this
            ->get('base.object_repository_provider')
            ->getObjectRepositoryByEntityNamespace(
                $this->locateEntity($entityNamespace)
            );
    }
164343
public function create($nodeEntityClass)
    {
        $reflectionClass = new \ReflectionClass($nodeEntityClass);
        /** @var Node $annotation */
        $annotation = $this->reader->getClassAnnotation($reflectionClass, Node::class);

        if (null !== $annotation) {
            return new NodeAnnotationMetadata($annotation->label, $annotation->repository);
        }

        throw new MappingException(sprintf('The class "%s" is missing the "%s" annotation', $nodeEntityClass, Node::class));
    }
1327195
protected function setEntity($entityClass)
    {
        $this->repos = $this->doctrine->getRepository($entityClass);
        $this->className = $this->repos->getClassName();
        $this->classMetaData = $this->metadataFactory->getMetadataForClass($this->className);
    }
218746
private function createDataMapper($entityClass)
    {
        /** @var DataMapperInterface $dataMapper */
        $dataMapperClass = isset($this->config['dataMapper']) ? $this->config['dataMapper'] : DoctrineDataMapper::class;

        $meta = $this->builder->getMeta($entityClass);

        if ($meta->storage['type'] == 'api') {
            $dataMapperClass = $meta->storage['handler'];
        }

        switch ($dataMapperClass) {
            case CsvDataMapper::class:
                $connectionClass = CsvDataGateway::class;

                break;

            default:
                $connectionClass = Connection::class;

                break;
        }

        $dataMapper = new $dataMapperClass(
            $this->getConnection($connectionClass),
            $entityClass,
            $meta->storage['table'],
            $this->entityRegistry
        );

        if ($dataMapper instanceof DispatcherAwareInterface) {
            $dataMapper->setDispatcher($this->getDispatcher());
        }

        return $dataMapper;
    }
30910
public function find($documentName, $identifier, $lockMode = LockMode::NONE, $lockVersion = null) : ?object
    {
        $repository = $this->getRepository($documentName);
        if ($repository instanceof DocumentRepository) {
            return $repository->find($identifier, $lockMode, $lockVersion);
        }

        return $repository->find($identifier);
    }
776139
public static function makeResourceRepository(string $repository): Repository
    {
        $api = App::make(ApiClient::class);

        return new $repository($api);
    }
1002566
private function createRepository($entityClass)
    {
        $repository = new EntityRepository();
        $repository->setAdapter(
            $this->adapters->get($this->getAdapterAlias($entityClass))
        )
            ->setEntityMapper($this->getMapperFor($entityClass))
            ->setEntityDescriptor(
                EntityDescriptorRegistry::getInstance()
                    ->getDescriptorFor($entityClass)
            );
        $this->repositories->set($entityClass, $repository);
        return $repository;
    }
63790
protected function createRepository(DocumentManagerInterface $dm, $documentName)
    {
        $metadata = $dm->getClassMetadata($documentName);
        $repositoryClassName = $metadata->customRepositoryClassName;

        if ($repositoryClassName === null) {
            $configuration = $dm->getConfiguration();
            $repositoryClassName = $configuration->getDefaultRepositoryClassName();
        }

        return new $repositoryClassName($dm, $metadata);
    }
1123253
public function setEntityClass($entityClass)
    {
        if (!is_string($entityClass)) {
            throw new \InvalidArgumentException('The attribute entityClass on the class Project has to be string (' . gettype($entityClass) . ('object' === gettype($entityClass) ? ' ' . get_class($entityClass) : '') . ' given).');
        }

        $this->entityClass = $entityClass;

        return $this;
    }
416504
public function getRepository($documentName)
    {
        $documentName = ltrim($documentName, '\\');

        if (isset($this->repositories[$documentName])) {
            return $this->repositories[$documentName];
        }

        $metadata = $this->getClassMetadata($documentName);
        $customRepositoryClassName = $metadata->customRepositoryClassName;

        if ($customRepositoryClassName !== null) {
            $repository = new $customRepositoryClassName($this, $this->unitOfWork, $metadata);
        } else {
            $repository = new DocumentRepository($this, $this->unitOfWork, $metadata);
        }

        $this->repositories[$documentName] = $repository;

        return $repository;
    }
442056
public function setDocument(\Neobazaar\Entity\Document $document = null)
    {
        $this->document = $document;
    
        return $this;
    }
19378
public function getRepositoryFor($class)
    {
        $metadata = $this->getMetadataManager()->getMetadataFor($class);
        $repositoryClass = $metadata->getEntityRepositoryClass();
        
        $identity = new ObjectIdentity(sprintf('%s@%s', $repositoryClass, $class));
        
        if (!$this->getClassManager()->hasShared($identity->getIdentifier())) {
            $repository = $this->getClassManager()->createInstanceFor($repositoryClass, ...[$class]);
            $this->getClassManager()->setShared($identity->getIdentifier(), $repository);
        }
        
        return $this->getClassManager()->getShared($identity->getIdentifier());
    }
437695
protected function loadResource(string $entityClass, string $rel)
    {
        $uri = $this->resource->getLinks()->getHref($rel);

        return $this->restClient->getResource($entityClass, $uri)->getEntity();
    }