Skip to content

Commit

Permalink
Deprecate Schema::getTableNames()
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Sep 22, 2021
1 parent 5e3c4c5 commit 6509b90
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ awareness about deprecated code.

# Upgrade to 3.2

## Deprecated `Schema::getTableNames()`.

The `Schema::getTableNames()` method has been deprecated. In order to obtain schema table names,
use `Schema::getTables()` and call `Table::getName()` on the elements of the returned array.

## Deprecated `AbstractPlatform::canEmulateSchemas()`.

The `AbstractPlatform::canEmulateSchemas()` method and the schema emulation implemented in the SQLite platform
Expand Down
11 changes: 11 additions & 0 deletions src/Schema/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector;
use Doctrine\DBAL\Schema\Visitor\NamespaceVisitor;
use Doctrine\DBAL\Schema\Visitor\Visitor;
use Doctrine\Deprecations\Deprecation;

use function array_keys;
use function strpos;
Expand Down Expand Up @@ -246,10 +247,20 @@ public function hasTable($name)
/**
* Gets all table names, prefixed with a schema name, even the default one if present.
*
* @deprecated Use {@link getTables()} and {@link Table::getName()} instead.
*
* @return string[]
*/
public function getTableNames()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4800',
'Schema::getTableNames() is deprecated.'
. ' Use Schema::getTables() and Table::getName() instead.',
__METHOD__
);

return array_keys($this->_tables);
}

Expand Down

0 comments on commit 6509b90

Please sign in to comment.