function LoggedStatementsTrait::getDriverClass

Same name in other branches
  1. 9 core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php \Drupal\database_statement_monitoring_test\LoggedStatementsTrait::getDriverClass()
  2. 8.9.x 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 53

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);
}

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