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