function Connection::getDriverClass

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

... See full list

File

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

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function getDriverClass($class) {
    if (empty($this->driverClasses[$class])) {
        $driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
        if (class_exists($driver_class)) {
            $this->driverClasses[$class] = $driver_class;
        }
        else {
            switch ($class) {
                case 'Condition':
                    $this->driverClasses[$class] = Condition::class;
                    break;
                case 'Delete':
                    $this->driverClasses[$class] = Delete::class;
                    break;
                case 'ExceptionHandler':
                    $this->driverClasses[$class] = ExceptionHandler::class;
                    break;
                case 'Insert':
                    $this->driverClasses[$class] = Insert::class;
                    break;
                case 'Merge':
                    $this->driverClasses[$class] = Merge::class;
                    break;
                case 'Schema':
                    $this->driverClasses[$class] = Schema::class;
                    break;
                case 'Select':
                    $this->driverClasses[$class] = Select::class;
                    break;
                case 'Transaction':
                    $this->driverClasses[$class] = Transaction::class;
                    break;
                case 'Truncate':
                    $this->driverClasses[$class] = Truncate::class;
                    break;
                case 'Update':
                    $this->driverClasses[$class] = Update::class;
                    break;
                case 'Upsert':
                    $this->driverClasses[$class] = Upsert::class;
                    break;
                default:
                    $this->driverClasses[$class] = $class;
            }
        }
    }
    return $this->driverClasses[$class];
}

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