Conditions | 7 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7.2269 |
Changes | 0 |
1 | <?php |
||
21 | 40 | public function loadClassMetadata(LoadClassMetadataEventArgs $args): void |
|
22 | { |
||
23 | 40 | $classMetadata = $args->getClassMetadata(); |
|
24 | 40 | if ($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) { |
|
25 | // if we are in an inheritance hierarchy, only apply this once |
||
26 | 40 | return; |
|
27 | } |
||
28 | 40 | if (false !== strpos($classMetadata->namespace, 'Cdf\BiCoreBundle')) { |
|
29 | 39 | $tableprefix = $this->tableprefix; |
|
30 | 39 | $classMetadata->setPrimaryTable(array('name' => $tableprefix . $classMetadata->getTableName())); |
|
31 | 39 | foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { |
|
32 | 37 | if (\Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY == $mapping['type'] && |
|
33 | 37 | isset($classMetadata->associationMappings[$fieldName]['joinTable']['name']) |
|
34 | ) { |
||
35 | $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name']; |
||
36 | $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $tableprefix . $mappedTableName; |
||
37 | } |
||
42 |