function db_driver in Drupal 8
Same name and namespace in other branches
- 7 includes/database/database.inc \db_driver()
Retrieves the name of the currently active database driver.
Return value
string The name of the currently active database driver.
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call driver() on it. For example, $injected_database->driver($string);
See also
https://www.drupal.org/node/2993033
\Drupal\Core\Database\Connection::driver()
Related topics
1 call to db_driver()
- DatabaseLegacyTest::testDbDriver in core/
tests/ Drupal/ KernelTests/ Core/ Database/ DatabaseLegacyTest.php - Tests deprecation of the db_driver() function.
File
- core/
includes/ database.inc, line 436 - Core systems for the database layer.
Code
function db_driver() {
@trigger_error('db_driver() is deprecated in drupal:8.0.0. It will be removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call driver() on it. For example, $injected_database->driver($string). See https://www.drupal.org/node/2993033', E_USER_DEPRECATED);
return Database::getConnection()
->driver();
}