Skip to content

Commit

Permalink
Merge pull request doctrine#5769 from morozov/remove-deprecated
Browse files Browse the repository at this point in the history
Remove the APIs deprecated in DBAL 3.x
  • Loading branch information
morozov committed Oct 17, 2022
2 parents 750c448 + 5dfbdee commit a89d540
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 55 deletions.
1 change: 1 addition & 0 deletions UPGRADE.md
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
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
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
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
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
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
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

0 comments on commit a89d540

Please sign in to comment.