Skip to content
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

Extend AbstractMySQLPlatform::getColumnTypeSQLSnippets() deprecation layer #6215

Merged
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
8 changes: 5 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ awareness about deprecated code.

# Upgrade to 3.8

## Deprecated `AbstractMySQLPlatform::getColumnTypeSQLSnippets()`
## Deprecated `AbstractMySQLPlatform` methods

`AbstractMySQLPlatform::getColumnTypeSQLSnippets()` has been deprecated.
Use `AbstractMySQLPlatform::getColumnTypeSQLSnippet()` instead.
* `AbstractMySQLPlatform::getColumnTypeSQLSnippets()` has been deprecated
in favor of `AbstractMySQLPlatform::getColumnTypeSQLSnippet()`.
* `AbstractMySQLPlatform::getDatabaseNameSQL()` has been deprecated without replacement.
* Not passing a database name to `AbstractMySQLPlatform::getColumnTypeSQLSnippet()` has been deprecated.

## Deprecated reset methods from `QueryBuilder`

Expand Down
1 change: 1 addition & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getColumnTypeSQLSnippets" />
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getDatabaseNameSQL" />

<!-- TODO for PHPUnit 10 -->
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::withConsecutive"/>
Expand Down
8 changes: 8 additions & 0 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,16 @@ public function supportsColumnLengthIndexes(): bool
return true;
}

/** @deprecated Will be removed without replacement. */
protected function getDatabaseNameSQL(?string $databaseName): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6215',
'%s is deprecated without replacement.',
__METHOD__,
);

if ($databaseName !== null) {
return $this->quoteStringLiteral($databaseName);
}
Expand Down
11 changes: 11 additions & 0 deletions src/Platforms/MariaDb1043Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Types\JsonType;
use Doctrine\Deprecations\Deprecation;

use function sprintf;

Expand Down Expand Up @@ -81,6 +82,16 @@ public function getColumnTypeSQLSnippet(string $tableAlias = 'c', ?string $datab
return parent::getColumnTypeSQLSnippet($tableAlias, $databaseName);
}

if ($databaseName === null) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6215',
'Not passing a database name to methods "getColumnTypeSQLSnippet()", '
. '"getColumnTypeSQLSnippets()", and "getListTableColumnsSQL()" of "%s" is deprecated.',
self::class,
);
}

$databaseName = $this->getDatabaseNameSQL($databaseName);

// The check for `CONSTRAINT_SCHEMA = $databaseName` is mandatory here to prevent performance issues
Expand Down