From 3b7b3ef5b81123ea7e3ad65bf99007f4a8e51048 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Thu, 17 Feb 2022 17:26:19 -0800 Subject: [PATCH] Remove $database from AbstractSchemaManager::list*() methods --- UPGRADE.md | 8 ++++++ src/Schema/AbstractSchemaManager.php | 39 +++++----------------------- src/Schema/SqliteSchemaManager.php | 2 +- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index b91ecd51763..b300b6904c7 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,14 @@ awareness about deprecated code. # Upgrade to 4.0 +## Removed support for the `$database` parameter of `AbstractSchemaManager::list*()` methods + +Passing `$database` to the following methods is no longer supported: + +- `AbstractSchemaManager::listSequences()`, +- `AbstractSchemaManager::listTableColumns()`, +- `AbstractSchemaManager::listTableForeignKeys()`. + ## Removed `AbstractPlatform` schema introspection methods The following schema introspection methods have been removed: diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php index 1bafd1ff7d4..eb89fc8bf0b 100644 --- a/src/Schema/AbstractSchemaManager.php +++ b/src/Schema/AbstractSchemaManager.php @@ -13,7 +13,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\Exception\NotSupported; use Doctrine\DBAL\Result; -use Doctrine\Deprecations\Deprecation; use function array_filter; use function array_intersect; @@ -98,17 +97,9 @@ public function listSchemaNames(): array * * @throws Exception */ - public function listSequences(?string $database = null): array + public function listSequences(): array { - if ($database === null) { - $database = $this->getDatabase(__METHOD__); - } else { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listSequences() is deprecated.' - ); - } + $database = $this->getDatabase(__METHOD__); $sql = $this->_platform->getListSequencesSQL($database); @@ -131,17 +122,9 @@ public function listSequences(?string $database = null): array * * @throws Exception */ - public function listTableColumns(string $table, ?string $database = null): array + public function listTableColumns(string $table): array { - if ($database === null) { - $database = $this->getDatabase(__METHOD__); - } else { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.' - ); - } + $database = $this->getDatabase(__METHOD__); return $this->_getPortableTableColumnList( $table, @@ -292,7 +275,7 @@ public function listTableDetails(string $name): Table return new Table( $name, - $this->listTableColumns($name, $database), + $this->listTableColumns($name), $this->listTableIndexes($name), [], $foreignKeys, @@ -368,17 +351,9 @@ public function listViews(): array * * @throws Exception */ - public function listTableForeignKeys(string $table, ?string $database = null): array + public function listTableForeignKeys(string $table): array { - if ($database === null) { - $database = $this->getDatabase(__METHOD__); - } else { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.' - ); - } + $database = $this->getDatabase(__METHOD__); return $this->_getPortableTableForeignKeysList( $this->selectDatabaseForeignKeys( diff --git a/src/Schema/SqliteSchemaManager.php b/src/Schema/SqliteSchemaManager.php index 85afec7c195..628b8b410a5 100644 --- a/src/Schema/SqliteSchemaManager.php +++ b/src/Schema/SqliteSchemaManager.php @@ -93,7 +93,7 @@ public function dropForeignKey(string $name, string $table): void /** * {@inheritdoc} */ - public function listTableForeignKeys(string $table, ?string $database = null): array + public function listTableForeignKeys(string $table): array { $tableForeignKeys = $this->selectDatabaseForeignKeys('', $this->normalizeName($table)) ->fetchAllAssociative();