Skip to content

Commit

Permalink
Fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
vpArth committed Oct 1, 2019
1 parent 19b097d commit 7373fa7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
42 changes: 21 additions & 21 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,29 +742,29 @@ private function gatherRelationJoinColumns(
&& ($foreignTableName !== $addedFks[$compositeName]['foreignTableName']
|| 0 < count(array_diff($foreignColumns, $addedFks[$compositeName]['foreignColumns'])))
) {
foreach ($theJoinTable->getForeignKeys() as $fkName => $key) {
if (count(array_diff($key->getLocalColumns(), $localColumns)) === 0
&& (($key->getForeignTableName() !== $foreignTableName)
|| 0 < count(array_diff($key->getForeignColumns(), $foreignColumns)))
) {
$theJoinTable->removeForeignKey($fkName);
break;
foreach ($theJoinTable->getForeignKeys() as $fkName => $key) {
if (count(array_diff($key->getLocalColumns(), $localColumns)) === 0
&& (($key->getForeignTableName() !== $foreignTableName)
|| 0 < count(array_diff($key->getForeignColumns(), $foreignColumns)))
) {
$theJoinTable->removeForeignKey($fkName);
break;
}
}
}

$blacklistedFks[$compositeName] = true;
} elseif (!isset($blacklistedFks[$compositeName])) {
$addedFks[$compositeName] = [
'foreignTableName' => $foreignTableName,
'foreignColumns' => $foreignColumns,
];

$theJoinTable->addForeignKeyConstraint(
$foreignTableName,
$localColumns,
$foreignColumns,
$fkOptions
);
$blacklistedFks[$compositeName] = true;
} elseif (! isset($blacklistedFks[$compositeName])) {
$addedFks[$compositeName] = [
'foreignTableName' => $foreignTableName,
'foreignColumns' => $foreignColumns,
];

$theJoinTable->addForeignKeyConstraint(
$foreignTableName,
$localColumns,
$foreignColumns,
$fkOptions
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ protected function setUp()
{
parent::setUp();
$this->em = $this->getTestEntityManager(TestUtil::getConnection());

$this->schemaTool = new SchemaTool($this->em);
}

public function testForeignKeysNotCompare(): void
public function testForeignKeysNotCompare() : void
{
if ($this->em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Test for platforms without foreign keys support');
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DDC2138Test extends OrmFunctionalTestCase
*/
public function testForeignKeyOnSTIWithMultipleMapping() : void
{
if (!$this->em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
if (! $this->em->getConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Platform does not support foreign keys.');
}
$schema = $this->schemaTool->getSchemaFromMetadata(
Expand Down

0 comments on commit 7373fa7

Please sign in to comment.