1 | <?php |
||
24 | class RepositoryManager implements RepositoryManagerInterface |
||
25 | { |
||
26 | /** @var array */ |
||
27 | protected $entities = []; |
||
28 | |||
29 | /** @var array */ |
||
30 | protected $repositories = []; |
||
31 | |||
32 | /** @var ManagerRegistry */ |
||
33 | protected $managerRegistry; |
||
34 | |||
35 | /** |
||
36 | * @var RepositoryManagerInterface |
||
37 | */ |
||
38 | private $repositoryManager; |
||
39 | |||
40 | /** |
||
41 | * @param ManagerRegistry $managerRegistry |
||
42 | * @param RepositoryManagerInterface $repositoryManager |
||
43 | */ |
||
44 | 1 | public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerInterface $repositoryManager) |
|
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function addType($indexTypeName, FinderInterface $finder, $repositoryName = null) |
||
57 | |||
58 | 1 | public function addEntity($entityName, $indexTypeName) |
|
62 | |||
63 | /** |
||
64 | * Returns custom repository if one specified otherwise returns a basic repository. |
||
65 | * |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 1 | public function getRepository($entityName) |
|
69 | { |
||
70 | 1 | $realEntityName = $entityName; |
|
71 | 1 | if (false !== strpos($entityName, ':')) { |
|
72 | list($namespaceAlias, $simpleClassName) = explode(':', $entityName); |
||
73 | $realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
||
74 | } |
||
75 | |||
76 | 1 | if (isset($this->entities[$realEntityName])) { |
|
77 | 1 | $realEntityName = $this->entities[$realEntityName]; |
|
78 | } |
||
79 | |||
80 | 1 | return $this->repositoryManager->getRepository($realEntityName); |
|
81 | } |
||
82 | |||
83 | public function hasRepository($typeName): bool |
||
87 | } |
||
88 |