You are here

public function LoggedStatementsTrait::getDriverClass in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php \Drupal\database_statement_monitoring_test\LoggedStatementsTrait::getDriverClass()
  2. 9 core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php \Drupal\database_statement_monitoring_test\LoggedStatementsTrait::getDriverClass()

File

core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php, line 46

Class

LoggedStatementsTrait
Trait for Connection classes that can store logged statements.

Namespace

Drupal\database_statement_monitoring_test

Code

public function getDriverClass($class) {
  static $fixed_namespace;
  if (!$fixed_namespace) {

    // Override because we've altered the namespace in
    // \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::getDatabaseConnectionInfo()
    // to use the logging Connection classes. Set to a proper database driver
    // namespace.
    $this->connectionOptions['namespace'] = (new \ReflectionClass(get_parent_class($this)))
      ->getNamespaceName();
    $fixed_namespace = TRUE;
  }
  return parent::getDriverClass($class);
}