Пример #1
0
 /**
  * Gets the repository for an entity class.
  *
  * @param string $entityName The name of the entity.
  * @return EntityRepository The repository class.
  */
 public function getRepository($entityName)
 {
     $entityName = ltrim($entityName, '\\');
     if (isset($this->repositories[$entityName])) {
         return $this->repositories[$entityName];
     }
     $metadata = $this->getClassMetadata($entityName);
     $repositoryClassName = $metadata->customRepositoryClassName;
     if ($repositoryClassName === null) {
         $repositoryClassName = $this->config->getDefaultRepositoryClassName();
     }
     $repository = new $repositoryClassName($this, $metadata);
     $this->repositories[$entityName] = $repository;
     return $repository;
 }