W3cubDocs

/Drupal 8

public function Connection::getDriverClass

public Connection::getDriverClass($class)

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 754

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

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;
  }
  return $this->driverClasses[$class];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Connection.php/function/Connection::getDriverClass/8.1.x