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];
}
doc_Drupal
2016-10-29 08:55:49
Comments
Leave a Comment

Please login to continue.