Conditions | 7 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 7.0283 |
Changes | 0 |
1 | <?php |
||
20 | 37 | public function loadClassMetadata(LoadClassMetadataEventArgs $args) |
|
21 | { |
||
22 | 37 | $classMetadata = $args->getClassMetadata(); |
|
23 | 37 | if ($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) { |
|
24 | // if we are in an inheritance hierarchy, only apply this once |
||
25 | 37 | return; |
|
26 | } |
||
27 | 37 | if (false !== strpos($classMetadata->namespace, 'Cdf\BiCoreBundle')) { |
|
28 | 36 | $tableprefix = $this->tableprefix; |
|
29 | 36 | $classMetadata->setPrimaryTable(array('name' => $tableprefix . $classMetadata->getTableName())); |
|
30 | 36 | foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) { |
|
31 | 34 | if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && |
|
32 | 34 | isset($classMetadata->associationMappings[$fieldName]['joinTable']['name']) |
|
33 | ) { |
||
34 | $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name']; |
||
|
|||
35 | 34 | $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $tableprefix . $mappedTableName; |
|
36 | } |
||
41 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.