Skip to content

Commit f9b579a

Browse files
committed
Removed Table::removeForeignKey() and ::removeUniqueConstraint()
1 parent b1770c7 commit f9b579a

File tree

5 files changed

+10
-45
lines changed

5 files changed

+10
-45
lines changed

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ awareness about deprecated code.
88

99
# Upgrade to 5.0
1010

11+
## BC BREAK: Removed `Table::removeForeignKey()` and `::removeUniqueConstraint()`
12+
13+
The `Table::removeForeignKey()` and `::removeUniqueConstraint()` have been removed.
14+
1115
## BC BREAK: Removed `AbstractPlatform` constants
1216

1317
The `CREATE_INDEXES` and `CREATE_FOREIGNKEYS` constants have been removed from the `AbstractPlatform` class.

psalm.xml.dist

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@
5555

5656
<!-- TODO for PHPUnit 11 -->
5757
<referencedMethod name="PHPUnit\Framework\TestCase::iniSet"/>
58-
59-
<!--
60-
https://github.com/doctrine/dbal/pull/6560
61-
TODO: remove in 5.0.0
62-
-->
63-
<referencedMethod name="Doctrine\DBAL\Schema\Table::removeForeignKey" />
64-
<referencedMethod name="Doctrine\DBAL\Schema\Table::removeUniqueConstraint" />
6558
</errorLevel>
6659
</DeprecatedMethod>
6760
<DocblockTypeContradiction>

src/Schema/Table.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,6 @@ public function getForeignKey(string $name): ForeignKeyConstraint
436436
return $this->_fkConstraints[$name];
437437
}
438438

439-
/**
440-
* Removes the foreign key constraint with the given name.
441-
*
442-
* @deprecated Use {@link dropForeignKey()} instead.
443-
*/
444-
public function removeForeignKey(string $name): void
445-
{
446-
Deprecation::trigger(
447-
'doctrine/dbal',
448-
'https://github.com/doctrine/dbal/pull/6560',
449-
'Table::removeForeignKey() is deprecated. Use Table::removeForeignKey() instead.',
450-
);
451-
452-
$this->dropForeignKey($name);
453-
}
454-
455439
/**
456440
* Drops the foreign key constraint with the given name.
457441
*/
@@ -490,22 +474,6 @@ public function getUniqueConstraint(string $name): UniqueConstraint
490474
return $this->uniqueConstraints[$name];
491475
}
492476

493-
/**
494-
* Removes the unique constraint with the given name.
495-
*
496-
* @deprecated Use {@link dropUniqueConstraint()} instead.
497-
*/
498-
public function removeUniqueConstraint(string $name): void
499-
{
500-
Deprecation::trigger(
501-
'doctrine/dbal',
502-
'https://github.com/doctrine/dbal/pull/6560',
503-
'Table::removeUniqueConstraint() is deprecated. Use Table::dropUniqueConstraint() instead.',
504-
);
505-
506-
$this->dropUniqueConstraint($name);
507-
}
508-
509477
/**
510478
* Drops the unique constraint with the given name.
511479
*/

tests/Schema/AbstractComparatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function testTableAddForeignKey(): void
244244
self::assertCount(1, $tableDiff->getAddedForeignKeys());
245245
}
246246

247-
public function testTableRemoveForeignKey(): void
247+
public function testTableDropForeignKey(): void
248248
{
249249
$tableForeign = new Table('bar');
250250
$tableForeign->addColumn('id', Types::INTEGER);

tests/Schema/TableTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ public function testNormalizesColumnNames(string $assetName): void
855855

856856
$table->dropColumn($assetName);
857857
$table->dropIndex($assetName);
858-
$table->removeForeignKey($assetName);
858+
$table->dropForeignKey($assetName);
859859

860860
self::assertFalse($table->hasColumn($assetName));
861861
self::assertFalse($table->hasColumn('foo'));
@@ -918,25 +918,25 @@ public function testUniqueConstraintWithEmptyName(): void
918918
self::assertSame($uniqueConstraints[1], $constraints['fk_d87f7e0cda12812744761484']);
919919
}
920920

921-
public function testRemoveUniqueConstraint(): void
921+
public function testDropUniqueConstraint(): void
922922
{
923923
$table = new Table('foo');
924924
$table->addColumn('bar', Types::INTEGER);
925925
$table->addUniqueConstraint(['bar'], 'unique_constraint');
926926

927-
$table->removeUniqueConstraint('unique_constraint');
927+
$table->dropUniqueConstraint('unique_constraint');
928928

929929
self::assertFalse($table->hasUniqueConstraint('unique_constraint'));
930930
}
931931

932-
public function testRemoveUniqueConstraintUnknownNameThrowsException(): void
932+
public function testDropUniqueConstraintUnknownNameThrowsException(): void
933933
{
934934
$this->expectException(SchemaException::class);
935935

936936
$table = new Table('foo');
937937
$table->addColumn('bar', Types::INTEGER);
938938

939-
$table->removeUniqueConstraint('unique_constraint');
939+
$table->dropUniqueConstraint('unique_constraint');
940940
}
941941

942942
public function testDropColumnWithForeignKeyConstraint(): void

0 commit comments

Comments
 (0)