Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.016 |
Changes | 0 |
1 | <?php |
||
19 | 14 | public function getClassNameFromEntityName(string $entityname): string |
|
20 | { |
||
21 | 14 | $entities = $this->em->getConfiguration()->getMetadataDriverImpl()->getAllClassNames(); |
|
22 | 14 | $entityclassname = ''; |
|
23 | 14 | foreach ($entities as $entity) { |
|
24 | 14 | $parti = explode('\\', $entity); |
|
25 | 14 | if ($parti[count($parti) - 1] == $entityname) { |
|
26 | 14 | $entityclassname = $entity; |
|
27 | } |
||
28 | } |
||
29 | 14 | if (!$entityclassname) { |
|
30 | throw new Exception("Non riesco a trovare l'entità '" . $entityname . "', è stata generata?"); |
||
31 | } |
||
32 | |||
33 | 14 | return $entityclassname; |
|
34 | } |
||
36 |