| Total Complexity | 9 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class ChainManagerRegistry |
||
| 10 | { |
||
| 11 | /** @var array<ManagerRegistry> */ |
||
| 12 | private $managerRegistries; |
||
| 13 | |||
| 14 | /** @param array<ManagerRegistry> $managerRegistries */ |
||
| 15 | public function __construct(array $managerRegistries) |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getRepository($class): ObjectRepository |
||
| 25 | { |
||
| 26 | foreach ($this->managerRegistries as $managerRegistry) { |
||
| 27 | if ($repository = $managerRegistry->getRepository($class)) { |
||
| 28 | return $repository; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | throw new \LogicException("Cannot find repository for class $class"); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function getManagerForClass($class): ?ObjectManager |
||
| 44 | } |
||
| 45 | |||
| 46 | /** @return array<ObjectManager> */ |
||
| 47 | public function getManagers(): array |
||
| 58 |