AbstractSource::class, ]; /** * @var EntityManagerInterface */ private $entityManager; /** * @param string $layer * * @throws NotSetException * * @return string */ private function getRepositoryClassName(string $layer): string { $map = self::LAYER_CLASS_MAP; if (array_key_exists($layer, $map)) { return $map[$layer]; } throw new NotSetException('The requested layer is not mapped!'); } /** * @param EntityManagerInterface $entityManager */ public function __construct(EntityManagerInterface $entityManager) { $this->entityManager = $entityManager; } /** * @param string $layer * * @return RepositoryInterface */ public function getRepository(string $layer): RepositoryInterface { $repositoryClassName = $this->getRepositoryClassName($layer); return $this->entityManager->getRepository($repositoryClassName); } }