By daffie on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.3.x
Introduced in version:
10.3.0
Issue links:
Description:
An API-addition for the method Drupal\Core\Database\Schema::tableExists(). A second parameter is added named: $add_prefix, which defaults to TRUE. When the new parameter is not set, the method works the same as before the second parameter was added. When the second parameter is set to FALSE, the existance of the table is checked without adding its table prefix. When the table does not have a table prefix, the method work the same whether the second parameter is set to TRUE, FALSE or not set at all.
Before:
// The next line check whether the table 'my_table_name' exists. When the table has a prefix,
// it will be prepended to the table name before checking if the table exists.
$table_exists = Database::getConnection()->schema()->tableExists('my_table_name');
After:
// The next two lines check whether the table 'my_table_name' exists. When the table has a prefix,
// it will be prepended to the table name before checking if the table exists.
$table_exists = Database::getConnection()->schema()->tableExists('my_table_name');
$table_exists = Database::getConnection()->schema()->tableExists('my_table_name', TRUE);
// The next line check whether the table 'my_table_name' exists. When the table has a prefix,
// it will NOT be prepended to the table name before checking if the table exists.
$table_exists = Database::getConnection()->schema()->tableExists('my_table_name', FALSE);
Impacts:
Module developers