By amateescu on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-beta15
Issue links:
Description:
Drupal\Core\Database\Schema::findTables() used to have a warning comment that prefixing the table expression argument as well as the return value is left to the caller.
This restriction has been removed and findTables() expects an un-prefixed table expression argument and the return values are now also un-prefixed table names.
Example code before:
$pattern = $this->connection->tablePrefix() . '%';
$tables = $this->connection->schema()->findTables($pattern);
foreach ($tables as $key => $table) {
// Remove the prefix for the resultant script.
$table = str_replace($this->connection->tablePrefix(), '', $table);
// Do something with $table, which is now a virtual, un-prefixed table name...
}
Example code after:
$pattern = '%';
$tables = $this->connection->schema()->findTables($pattern);
foreach ($tables as $key => $table) {
// There is no need to remove any prefix for $table because it is already a
// virtual, un-prefixed table name.
}
Impacts:
Module developers