/** * Create a new repository instance for an entity class. * * @param \Doctrine\ORM\EntityManagerInterface $entityManager The EntityManager instance. * @param string $entityName The name of the entity. * * @return \Doctrine\Common\Persistence\ObjectRepository */ private function createRepository(EntityManagerInterface $entityManager, $entityName) { /* @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */ $metadata = $entityManager->getClassMetadata($entityName); $repositoryClassName = $metadata->customRepositoryClassName ?: $entityManager->getConfiguration()->getDefaultRepositoryClassName(); return new $repositoryClassName($entityManager, $metadata); }
/** * @inheritdoc */ protected function initialize() { $this->driver = $this->em->getConfiguration()->getMetadataDriverImpl(); $this->initialized = true; }