Skip to content

Commit

Permalink
Remove AbstractPlatform::prefersIdentityColumns()
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Dec 16, 2021
1 parent 45a846c commit 63e65da
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 126 deletions.
3 changes: 2 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ The `Doctrine\DBAL\Driver::getName()` has been removed.
* Removed `json_array` type and all associated hacks.
* Removed `Connection::TRANSACTION_*` constants.
* Removed `AbstractPlatform::DATE_INTERVAL_UNIT_*` and `AbstractPlatform::TRIM_*` constants.
* Removed `AbstractPlatform::getSQLResultCasing()`, `::prefersSequences()` and `::supportsForeignKeyOnUpdate()` methods.
* Removed `AbstractPlatform::getSQLResultCasing()`, `::prefersIdentityColumns()`, `::prefersSequences()`
and `::supportsForeignKeyOnUpdate()` methods.
* Removed `PostgreSqlPlatform::getDisallowDatabaseConnectionsSQL()` and `::getCloseActiveDatabaseConnectionsSQL()` methods.
* Removed `MysqlSessionInit` listener.
* Removed `MySQLPlatform::getCollationFieldDeclaration()`.
Expand Down
9 changes: 0 additions & 9 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
See https://github.com/doctrine/dbal/pull/5119
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::prefersIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::prefersIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\DB2Platform::prefersIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\SQLServerPlatform::prefersIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::prefersIdentityColumns"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
20 changes: 0 additions & 20 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\TextType;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function array_unique;
Expand Down Expand Up @@ -223,25 +222,6 @@ public function getBooleanTypeDeclarationSQL(array $column): string
return 'TINYINT(1)';
}

/**
* {@inheritDoc}
*
* @deprecated
*
* MySQL prefers "autoincrement" identity columns since sequences can only
* be emulated with a table.
*/
public function prefersIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pulls/1519',
'AbstractMySQLPlatform::prefersIdentityColumns() is deprecated.'
);

return true;
}

/**
* {@inheritDoc}
*
Expand Down
16 changes: 0 additions & 16 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
use Doctrine\DBAL\Types;
use Doctrine\DBAL\Types\Exception\TypeNotFound;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;
use UnexpectedValueException;

Expand Down Expand Up @@ -1902,21 +1901,6 @@ public function getColumnCollationDeclarationSQL(string $collation): string
return $this->supportsColumnCollation() ? 'COLLATE ' . $collation : '';
}

/**
* Whether the platform prefers identity columns (eg. autoincrement) for ID generation.
* Subclasses should override this method to return TRUE if they prefer identity columns.
*/
public function prefersIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pulls/1519',
'AbstractPlatform::prefersIdentityColumns() is deprecated.'
);

return false;
}

/**
* Some platforms need the boolean values to be converted.
*
Expand Down
15 changes: 0 additions & 15 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function count;
Expand Down Expand Up @@ -699,20 +698,6 @@ public function supportsIdentityColumns(): bool
return true;
}

/**
* @deprecated
*/
public function prefersIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pulls/1519',
'DB2Platform::prefersIdentityColumns() is deprecated.'
);

return true;
}

public function getForUpdateSQL(): string
{
return ' WITH RR USE AND KEEP UPDATE LOCKS';
Expand Down
20 changes: 0 additions & 20 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

use function array_merge;
Expand Down Expand Up @@ -87,25 +86,6 @@ public function getDateDiffExpression(string $date1, string $date2): string
return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')';
}

/**
* {@inheritDoc}
*
* Microsoft SQL Server prefers "autoincrement" identity columns
* since sequences can only be emulated with a table.
*
* @deprecated
*/
public function prefersIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pulls/1519',
'SQLServerPlatform::prefersIdentityColumns() is deprecated.'
);

return true;
}

/**
* {@inheritDoc}
*
Expand Down
15 changes: 0 additions & 15 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

use function array_combine;
Expand Down Expand Up @@ -160,20 +159,6 @@ public function getSetTransactionIsolationSQL(int $level): string
return 'PRAGMA read_uncommitted = ' . $this->_getTransactionIsolationLevelSQL($level);
}

/**
* @deprecated
*/
public function prefersIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pulls/1519',
'SqlitePlatform::prefersIdentityColumns() is deprecated.'
);

return true;
}

/**
* {@inheritDoc}
*/
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/AbstractMySQLPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ public function testGeneratesTypeDeclarationForIntegers(): void
);
}

public function testPrefersIdentityColumns(): void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}

public function testSupportsIdentityColumns(): void
{
self::assertTrue($this->platform->supportsIdentityColumns());
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/DB2PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ public function testModifiesLimitQuery(): void
);
}

public function testPrefersIdentityColumns(): void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}

public function testSupportsIdentityColumns(): void
{
self::assertTrue($this->platform->supportsIdentityColumns());
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/OraclePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ public function testGeneratesTypeDeclarationForIntegers(): void
);
}

public function testPrefersIdentityColumns(): void
{
self::assertFalse($this->platform->prefersIdentityColumns());
}

public function testSupportsIdentityColumns(): void
{
self::assertFalse($this->platform->supportsIdentityColumns());
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/PostgreSQLPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,6 @@ public function testGeneratesSequenceSqlCommands(): void
);
}

public function testDoesNotPreferIdentityColumns(): void
{
self::assertFalse($this->platform->prefersIdentityColumns());
}

public function testSupportsIdentityColumns(): void
{
self::assertTrue($this->platform->supportsIdentityColumns());
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/SQLServerPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ public function testGeneratesTypeDeclarationsForStrings(): void
);
}

public function testPrefersIdentityColumns(): void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}

public function testSupportsIdentityColumns(): void
{
self::assertTrue($this->platform->supportsIdentityColumns());
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/SqlitePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ public function testGeneratesTransactionCommands(): void
);
}

public function testPrefersIdentityColumns(): void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}

public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers(): void
{
self::assertSame(
Expand Down

0 comments on commit 63e65da

Please sign in to comment.