public function getRepository($documentClass)
    {
        if (!isset($this->repositories[$documentClass])) {
            if (!$this->metadataFactory->hasClass($documentClass) || !$this->metadataFactory->isDocumentClass($documentClass)) {
                throw new \InvalidArgumentException(sprintf('The class "%s" is not a valid document class.', $documentClass));
            }

            $repositoryClass = $documentClass.'Repository';
            if (!class_exists($repositoryClass)) {
                throw new \RuntimeException(sprintf('The class "%s" does not exists.', $repositoryClass));
            }

            $this->repositories[$documentClass] = new $repositoryClass($this);
        }

        return $this->repositories[$documentClass];
    }
public function getRepository($documentClass)
    {
        if (!isset($this->repositories[$documentClass])) {
            if (!$this->metadataFactory->hasClass($documentClass) || !$this->metadataFactory->isDocumentClass($documentClass)) {
                throw new \InvalidArgumentException(sprintf('The class "%s" is not a valid document class.', $documentClass));
            }

            $repositoryClass = $documentClass.'Repository';
            if (!class_exists($repositoryClass)) {
                throw new \RuntimeException(sprintf('The class "%s" does not exists.', $repositoryClass));
            }

            $this->repositories[$documentClass] = new $repositoryClass($this);
        }

        return $this->repositories[$documentClass];
    }
public function getRepository ( $ documentClass ) { if ( ! isset ( $ this -> repositories [ $ documentClass ] ) ) { if ( ! $ this -> metadataFactory -> hasClass ( $ documentClass ) || ! $ this -> metadataFactory -> isDocumentClass ( $ documentClass ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The class "%s" is not a valid document class.' , $ documentClass ) ) ; } $ repositoryClass = $ documentClass . 'Repository' ; if ( ! class_exists ( $ repositoryClass ) ) { throw new \ RuntimeException ( sprintf ( 'The class "%s" does not exists.' , $ repositoryClass ) ) ; } $ this -> repositories [ $ documentClass ] = new $ repositoryClass ( $ this ) ; } return $ this -> repositories [ $ documentClass ] ; }
Returns repositories by document class.

@param string $documentClass The document class.

@return \Mandango\Repository The repository.

@throws \InvalidArgumentException If the document class is not a valid document class.
@throws \RuntimeException         If the repository class build does not exist.

@api
Returns repositories by document class .