1 | <?php |
||
24 | class RepositoryManager implements RepositoryManagerInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $indexes; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $repositories; |
||
35 | |||
36 | 5 | public function __construct() |
|
41 | |||
42 | 5 | public function addIndex(string $indexName, FinderInterface $finder, string $repositoryName = null): void |
|
43 | { |
||
44 | 5 | $this->indexes[$indexName] = [ |
|
45 | 5 | 'finder' => $finder, |
|
46 | 5 | 'repositoryName' => $repositoryName, |
|
47 | ]; |
||
48 | 5 | } |
|
49 | |||
50 | /** |
||
51 | * Return repository for entity. |
||
52 | * |
||
53 | * Returns custom repository if one specified otherwise |
||
54 | * returns a basic repository. |
||
55 | * |
||
56 | * @param string $indexName |
||
57 | * |
||
58 | * @return Repository |
||
59 | */ |
||
60 | 5 | public function getRepository(string $indexName): Repository |
|
75 | |||
76 | /** |
||
77 | * @param $indexName |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 4 | protected function getRepositoryName($indexName) |
|
89 | |||
90 | /** |
||
91 | * @param $indexName |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | 4 | private function createRepository($indexName) |
|
103 | |||
104 | 5 | public function hasRepository(string $indexName): bool |
|
108 | } |
||
109 |