public function Connection::getDriverClass in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::getDriverClass()
Gets the driver-specific override class if any for the specified class.
Parameters
string $class: The class for which we want the potentially driver-specific class.
Return value
string The name of the class that should be used for this driver.
11 calls to Connection::getDriverClass()
- Connection::condition in core/
lib/ Drupal/ Core/ Database/ Connection.php - Prepares and returns a CONDITION query object.
- Connection::delete in core/
lib/ Drupal/ Core/ Database/ Connection.php - Prepares and returns a DELETE query object.
- Connection::insert in core/
lib/ Drupal/ Core/ Database/ Connection.php - Prepares and returns an INSERT query object.
- Connection::merge in core/
lib/ Drupal/ Core/ Database/ Connection.php - Prepares and returns a MERGE query object.
- Connection::schema in core/
lib/ Drupal/ Core/ Database/ Connection.php - Returns a DatabaseSchema object for manipulating the schema.
File
- core/
lib/ Drupal/ Core/ Database/ Connection.php, line 785
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
public function getDriverClass($class) {
if (empty($this->driverClasses[$class])) {
if (empty($this->connectionOptions['namespace'])) {
// Fallback for Drupal 7 settings.php and the test runner script.
$this->connectionOptions['namespace'] = (new \ReflectionObject($this))
->getNamespaceName();
}
$driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
$this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
if ($this->driverClasses[$class] === 'Condition') {
// @todo Deprecate the fallback for contrib and custom drivers in 9.1.x
// in https://www.drupal.org/project/drupal/issues/3120036.
$this->driverClasses[$class] = Condition::class;
}
}
return $this->driverClasses[$class];
}