Skip to content

Remove the APIs deprecated in DBAL 3.x #5769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ or `createFunction()` on the PDO or SQLite3 connection.

The following `Table` methods have been removed:

- `changeColumn()`,
- `getForeignKeyColumns()`,
- `getPrimaryKeyColumns()`,
- `hasPrimaryKey()`.
Expand Down
12 changes: 0 additions & 12 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,8 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\Table::changeColumn"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
<errorLevel type="suppress">
<!--
TODO: remove in 4.0.0
-->
<referencedProperty name="Doctrine\DBAL\Schema\SchemaDiff::$orphanedForeignKeys"/>
</errorLevel>
</DeprecatedProperty>
<DocblockTypeContradiction>
<errorLevel type="suppress">
<!--
Expand Down
20 changes: 0 additions & 20 deletions src/Schema/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Doctrine\DBAL\Schema\Exception\InvalidTableName;
use Doctrine\DBAL\Schema\Exception\UniqueConstraintDoesNotExist;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function array_values;
Expand Down Expand Up @@ -266,25 +265,6 @@ public function addColumn(string $name, string $typeName, array $options = []):
return $column;
}

/**
* Change Column Details.
*
* @deprecated Use {@link modifyColumn()} instead.
*
* @param array<string, mixed> $options
*/
public function changeColumn(string $name, array $options): self
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5747',
'%s is deprecated. Use modifyColumn() instead.',
__METHOD__,
);

return $this->modifyColumn($name, $options);
}

/** @param array<string, mixed> $options */
public function modifyColumn(string $name, array $options): self
{
Expand Down
19 changes: 6 additions & 13 deletions src/Types/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*/
final class Types
{
/** @deprecated Use {@link Types::JSON} instead. */
public const ARRAY = 'array';

public const ASCII_STRING = 'ascii_string';
public const BIGINT = 'bigint';
public const BINARY = 'binary';
Expand All @@ -29,16 +26,12 @@ final class Types
public const GUID = 'guid';
public const INTEGER = 'integer';
public const JSON = 'json';

/** @deprecated Use {@link Types::JSON} instead. */
public const OBJECT = 'object';

public const SIMPLE_ARRAY = 'simple_array';
public const SMALLINT = 'smallint';
public const STRING = 'string';
public const TEXT = 'text';
public const TIME_MUTABLE = 'time';
public const TIME_IMMUTABLE = 'time_immutable';
public const SIMPLE_ARRAY = 'simple_array';
public const SMALLINT = 'smallint';
public const STRING = 'string';
public const TEXT = 'text';
public const TIME_MUTABLE = 'time';
public const TIME_IMMUTABLE = 'time_immutable';

/** @codeCoverageIgnore */
private function __construct()
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Schema/OracleSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function testAlterTableColumnNotNull(): void
self::assertTrue($columns['bar']->getNotnull());

$diffTable = clone $table;
$diffTable->changeColumn('foo', ['notnull' => false]);
$diffTable->changeColumn('bar', ['length' => 1024]);
$diffTable->modifyColumn('foo', ['notnull' => false]);
$diffTable->modifyColumn('bar', ['length' => 1024]);

$diff = $this->schemaManager->createComparator()
->diffTable($table, $diffTable);
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,10 @@ public function testColumnDefaultLifecycle(): void

$newTable = clone $oldTable;

$newTable->changeColumn('column1', ['default' => '']);
$newTable->changeColumn('column2', ['default' => null]);
$newTable->changeColumn('column3', ['default' => 'default2']);
$newTable->changeColumn('column4', ['default' => null]);
$newTable->modifyColumn('column1', ['default' => '']);
$newTable->modifyColumn('column2', ['default' => null]);
$newTable->modifyColumn('column3', ['default' => 'default2']);
$newTable->modifyColumn('column4', ['default' => null]);

$diff = $this->schemaManager->createComparator()
->diffTable(
Expand Down
8 changes: 4 additions & 4 deletions tests/Platforms/AbstractMySQLPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ public function testIgnoresDifferenceInDefaultValuesForUnsupportedColumnTypes():
);

$diffTable = clone $table;
$diffTable->changeColumn('def_text', ['default' => null]);
$diffTable->changeColumn('def_text_null', ['default' => null]);
$diffTable->changeColumn('def_blob', ['default' => null]);
$diffTable->changeColumn('def_blob_null', ['default' => null]);
$diffTable->modifyColumn('def_text', ['default' => null]);
$diffTable->modifyColumn('def_text_null', ['default' => null]);
$diffTable->modifyColumn('def_blob', ['default' => null]);
$diffTable->modifyColumn('def_blob_null', ['default' => null]);

self::assertNull($this->createComparator()->diffTable($table, $diffTable));
}
Expand Down