Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 0 |
1 | <?php |
||
47 | 7 | private function getEntityManager(object $data): EntityManagerInterface |
|
48 | { |
||
49 | 7 | if (!$this->registry) { |
|
50 | throw new BadMethodCallException('initRegistry should be called first. Registry property does not exist'); |
||
51 | } |
||
52 | |||
53 | 7 | $em = $this->registry->getManagerForClass($this->getObjectClass($data)); |
|
54 | 7 | if (!$em instanceof EntityManagerInterface) { |
|
55 | throw ORMInvalidArgumentException::invalidObject(__CLASS__ . '::' . __FUNCTION__, $data); |
||
56 | } |
||
57 | |||
58 | 7 | return $em; |
|
59 | } |
||
61 |