Skip to content

Commit

Permalink
Merge pull request #6583 from morozov/remove-deprecated
Browse files Browse the repository at this point in the history
Remove deprecated
  • Loading branch information
morozov authored Nov 3, 2024
2 parents cff771b + f9b579a commit 5ecf632
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 51 deletions.
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ awareness about deprecated code.

# Upgrade to 5.0

## BC BREAK: Removed `Table::removeForeignKey()` and `::removeUniqueConstraint()`

The `Table::removeForeignKey()` and `::removeUniqueConstraint()` have been removed.

## BC BREAK: Removed `AbstractPlatform` constants

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

## BC BREAK: Add `Result::getColumnName()`

A new method `getColumnName()` has been added to the `Result` interface and must be implemented by
Expand Down
7 changes: 0 additions & 7 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@

<!-- TODO for PHPUnit 11 -->
<referencedMethod name="PHPUnit\Framework\TestCase::iniSet"/>

<!--
https://github.com/doctrine/dbal/pull/6560
TODO: remove in 5.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\Table::removeForeignKey" />
<referencedMethod name="Doctrine\DBAL\Schema\Table::removeUniqueConstraint" />
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
6 changes: 0 additions & 6 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@
*/
abstract class AbstractPlatform
{
/** @deprecated */
public const CREATE_INDEXES = 1;

/** @deprecated */
public const CREATE_FOREIGNKEYS = 2;

/** @var string[]|null */
protected ?array $doctrineTypeMapping = null;

Expand Down
32 changes: 0 additions & 32 deletions src/Schema/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,6 @@ public function getForeignKey(string $name): ForeignKeyConstraint
return $this->_fkConstraints[$name];
}

/**
* Removes the foreign key constraint with the given name.
*
* @deprecated Use {@link dropForeignKey()} instead.
*/
public function removeForeignKey(string $name): void
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6560',
'Table::removeForeignKey() is deprecated. Use Table::removeForeignKey() instead.',
);

$this->dropForeignKey($name);
}

/**
* Drops the foreign key constraint with the given name.
*/
Expand Down Expand Up @@ -490,22 +474,6 @@ public function getUniqueConstraint(string $name): UniqueConstraint
return $this->uniqueConstraints[$name];
}

/**
* Removes the unique constraint with the given name.
*
* @deprecated Use {@link dropUniqueConstraint()} instead.
*/
public function removeUniqueConstraint(string $name): void
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6560',
'Table::removeUniqueConstraint() is deprecated. Use Table::dropUniqueConstraint() instead.',
);

$this->dropUniqueConstraint($name);
}

/**
* Drops the unique constraint with the given name.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Schema/AbstractComparatorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function testTableAddForeignKey(): void
self::assertCount(1, $tableDiff->getAddedForeignKeys());
}

public function testTableRemoveForeignKey(): void
public function testTableDropForeignKey(): void
{
$tableForeign = new Table('bar');
$tableForeign->addColumn('id', Types::INTEGER);
Expand Down
10 changes: 5 additions & 5 deletions tests/Schema/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ public function testNormalizesColumnNames(string $assetName): void

$table->dropColumn($assetName);
$table->dropIndex($assetName);
$table->removeForeignKey($assetName);
$table->dropForeignKey($assetName);

self::assertFalse($table->hasColumn($assetName));
self::assertFalse($table->hasColumn('foo'));
Expand Down Expand Up @@ -918,25 +918,25 @@ public function testUniqueConstraintWithEmptyName(): void
self::assertSame($uniqueConstraints[1], $constraints['fk_d87f7e0cda12812744761484']);
}

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

$table->removeUniqueConstraint('unique_constraint');
$table->dropUniqueConstraint('unique_constraint');

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

public function testRemoveUniqueConstraintUnknownNameThrowsException(): void
public function testDropUniqueConstraintUnknownNameThrowsException(): void
{
$this->expectException(SchemaException::class);

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

$table->removeUniqueConstraint('unique_constraint');
$table->dropUniqueConstraint('unique_constraint');
}

public function testDropColumnWithForeignKeyConstraint(): void
Expand Down

0 comments on commit 5ecf632

Please sign in to comment.