Skip to content

Commit

Permalink
Remove AbstractPlatform::getName()
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Aug 27, 2021
1 parent 6ad8a77 commit 9505925
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 83 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: Removed `AbstractPlatform::getName()`

The `AbstractPlatform::getName()` method has been removed.

## BC BREAK: Removed versioned platform classes that represent the lowest supported version.

The following platform-related classes have been removed:
Expand Down
5 changes: 3 additions & 2 deletions src/Exception/ColumnLengthRequired.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;

use function get_class;
use function sprintf;

/**
Expand All @@ -22,8 +23,8 @@ public static function new(AbstractPlatform $platform, string $type): self
{
return new self(
sprintf(
'The "%s" platform requires the length of a %s column to be specified',
$platform->getName(),
'%s requires the length of a %s column to be specified',
get_class($platform),
$type
)
);
Expand Down
7 changes: 0 additions & 7 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,6 @@ abstract public function getClobTypeDeclarationSQL(array $column): string;
*/
abstract public function getBlobTypeDeclarationSQL(array $column): string;

/**
* Gets the name of the platform.
*
* @deprecated Identify platforms by their class.
*/
abstract public function getName(): string;

/**
* Registers a doctrine type to be used in conjunction with a column type of this platform.
*
Expand Down
12 changes: 0 additions & 12 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function count;
Expand Down Expand Up @@ -86,17 +85,6 @@ public function getClobTypeDeclarationSQL(array $column): string
return 'CLOB(1M)';
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'DB2Platform::getName() is deprecated. Identify platforms by their class.'
);

return 'db2';
}

/**
* {@inheritDoc}
*/
Expand Down
12 changes: 0 additions & 12 deletions src/Platforms/MySQLPlatform.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 InvalidArgumentException;

use function array_diff_key;
Expand Down Expand Up @@ -916,17 +915,6 @@ public function getSetTransactionIsolationSQL(int $level): string
return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'MySQLPlatform::getName() is deprecated. Identify platforms by their class.'
);

return 'mysql';
}

public function getReadLockSQL(): string
{
return 'LOCK IN SHARE MODE';
Expand Down
11 changes: 0 additions & 11 deletions src/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,17 +920,6 @@ public function supportsCommentOnStatement(): bool
return true;
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'OraclePlatform::getName() is deprecated. Identify platforms by their class.'
);

return 'oracle';
}

protected function doModifyLimitQuery(string $query, ?int $limit, int $offset): string
{
if ($limit === null && $offset <= 0) {
Expand Down
11 changes: 0 additions & 11 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,17 +922,6 @@ public function getClobTypeDeclarationSQL(array $column): string
return 'TEXT';
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'PostgreSQLPlatform::getName() is deprecated. Identify platforms by their class.'
);

return 'postgresql';
}

public function getDateTimeTzFormatString(): string
{
return 'Y-m-d H:i:sO';
Expand Down
12 changes: 0 additions & 12 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

use function array_merge;
Expand Down Expand Up @@ -1284,17 +1283,6 @@ public function getDateTimeTzFormatString(): string
return 'Y-m-d H:i:s.u P';
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'SQLServerPlatform::getName() is deprecated. Identify platforms by their class.'
);

return 'mssql';
}

protected function initializeDoctrineTypeMappings(): void
{
$this->doctrineTypeMapping = [
Expand Down
11 changes: 0 additions & 11 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,6 @@ public function supportsInlineColumnComments(): bool
return true;
}

public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4749',
'SqlitePlatform::getName() is deprecated. Identify platforms by their class.'
);

return 'sqlite';
}

public function getTruncateTableSQL(string $tableName, bool $cascade = false): string
{
$tableIdentifier = new Identifier($tableName);
Expand Down
5 changes: 0 additions & 5 deletions tests/Platforms/DB2PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ public function getCreateTableColumnTypeCommentsSQL(): array
];
}

public function testHasCorrectPlatformName(): void
{
self::assertEquals('db2', $this->platform->getName());
}

public function testGeneratesCreateTableSQLWithCommonIndexes(): void
{
$table = new Table('test');
Expand Down

0 comments on commit 9505925

Please sign in to comment.