function Connection::getDriverClass

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::getDriverClass()
  2. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::getDriverClass()
  3. 10 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.

File

core/lib/Drupal/Core/Database/Connection.php, line 742

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function getDriverClass($class) {
    match ($class) {    'Install\\Tasks', 'ExceptionHandler', 'Select', 'Insert', 'Merge', 'Upsert', 'Update', 'Delete', 'Truncate', 'Schema', 'Condition', 'Transaction' => throw new InvalidQueryException('Calling ' . __METHOD__ . '() for \'' . $class . '\' is not supported. Use standard autoloading in the methods that return database operations. See https://www.drupal.org/node/3217534'),
        default => NULL,
    
    };
    if (empty($this->driverClasses[$class])) {
        $driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
        $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
    }
    return $this->driverClasses[$class];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.