Problem/Motivation

There is a bug in the method Drupal\Core\Database\Connection::getDriverClass(). In the line: $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class; we state that when the driver does not implement the class, that we should take the default class. We return only the class name, not with its full namespace. And that is a problem when that class lives in another namespace then the current namespace (Drupal\Core\Database vs Drupal\Core\Database\Query). When we return the class with its full namespace, we can then remove all unnecessary classes from the database drivers.

This "functionality" was designed - see #2461239-8: Database driver class fallback is broken and stubbed instead - however it results in classes like


namespace Drupal\Core\Database\Driver\mysql;

use Drupal\Core\Database\Query\Select as QuerySelect;

/**
 * MySQL implementation of \Drupal\Core\Database\Query\Select.
 */
class Select extends QuerySelect {}

Which are pointless.

Proposed resolution

Correctly fallback to a core provided class if the database driver does not provide one.

Remaining tasks

User interface changes

None

API changes

The core database drivers have been cleaned up. Their classes are not API and if contrib or custom code is extending them they should extend the classes in Drupal\Core\Database\Query instead.

Data model changes

None

Release notes snippet

Contributed and custom database drivers no longer need to extend core's database agnostic database classes unless they need to override code provided functionality. The core database drivers have had unnecessary classes removed. Read the change record for the full list of classes removed.

Comments

daffie created an issue. See original summary.

daffie’s picture

StatusFileSize
new10.02 KB
daffie’s picture

Status: Active » Needs review
alexpott’s picture

@daffie I support this change but I know that there are old issues that have argued that this is the way it is meant to be. I think we need to find and reference the arguments they made here

beakerboy’s picture

If the core classes must be implemented by each driver, why wouldn't they be abstract? That would be the correct way to dictate that behavior IMO, not some buried discussion thread from years ago.

alexpott’s picture

So this issue is essentially a duplicate of #2461239: Database driver class fallback is broken and stubbed instead. In comment #8 in that issue the maintainer of the DB API at the time said

I think I follow what is being done here from the patch. However, this is a regression. Early in the D8 cycle we switched the child classes to always be required in order to simplify the code. I think I made that change as part of the namespace-ification.

I don't see a reason to go back here. The empty classes hurt no one, and the patch here introduces a while loop into the driver handling that seems completely unnecessary.

I agree with both @daffie and @Beakerboy - I not sure I agree with the decision taken early in the D8 cycle. And what @Beakerboy says is entirely correct:

why wouldn't they be abstract? That would be the correct way to dictate that behavior IMO

daffie’s picture

This issue is now about 2 things: the bug in the method Drupal\Core\Database\Connection::getDriverClass() and the policy decision whether or not to have empty database driver classes in the by core supported drivers.

Should we create a child issue for fixing the bug or can we do it in all one issue?

@catch said in #3120096-82: Support contrib database driver directories in a fixed location in a module in point 4 about the adding of empty driver classes: "So is this necessary for all contrib drivers now?". My conclusion is that @catch also does not like to have the empty driver classes.

alexpott’s picture

@daffie I think not. The two things are completed entangled and deserve to go together.

catch’s picture

My conclusion is that @catch also does not like to have the empty driver classes.

This conclusion is correct :)

daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This issue still needs testing. After #3120096: Support contrib database driver directories in a fixed location in a module has landed, this will be easy to do.

alexpott’s picture

  1. +++ b/core/lib/Drupal/Core/Database/Connection.php
    @@ -867,10 +874,37 @@ public function getDriverClass($class) {
           $driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
           $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
    -      if ($this->driverClasses[$class] === 'Condition') {
    -        // @todo Deprecate the fallback for contrib and custom drivers in 9.1.x
    -        //   in https://www.drupal.org/project/drupal/issues/3120036.
    -        $this->driverClasses[$class] = Condition::class;
    +      switch ($this->driverClasses[$class]) {
    

    This logic can be more performant. We only need to do the switch if class_exists($driver_class) is FALSE.

  2. +++ b/core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php
    @@ -3,6 +3,11 @@
    @@ -53,8 +58,19 @@ public function getDriverClass($class) {
    
    @@ -53,8 +58,19 @@ public function getDriverClass($class) {
         if (class_exists($driver_class)) {
           return $driver_class;
         }
    -    elseif ($class == 'Condition') {
    -      return Condition::class;
    +    switch ($class) {
    +      case 'Condition':
    +        return Condition::class;
    +      case 'Delete':
    +        return Delete::class;
    +      case 'Merge':
    +        return Merge::class;
    +      case 'Select':
    +        return Select::class;
    +      case 'Transaction':
    +        return Transaction::class;
    +      case 'Update':
    +        return Update::class;
         }
         return $class;
       }
    

    We can change this whole function to be

     /**
       * {@inheritdoc}
       */
      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);
      }
    

    That makes the implementation less special and easier to maintain.

abhisekmazumdar’s picture

Assigned: Unassigned » abhisekmazumdar

Updating the patch as per #11.

abhisekmazumdar’s picture

Assigned: abhisekmazumdar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new10.63 KB

Here is an updated patch. Kindly review.

Can't add an interdiff as the old patch was not applying.

Status: Needs review » Needs work

The last submitted patch, 13: remove_unnecessary_classes_from_db_driver-3124354-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

daffie’s picture

Version: 9.0.x-dev » 9.1.x-dev
Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new10.19 KB
new21.8 KB

Changed in this patch:
- Added a new database driver with no custom driver classes.
- Added testing for Connection->getDriverClass() for the default classes.
- Improved the readability of Connection->getDriverClass().
- A couple test fixes.

daffie’s picture

StatusFileSize
new21.83 KB

Forgot to do a git pull.

alexpott’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Database/Connection.php
    @@ -871,11 +878,42 @@ protected function expandArguments(&$query, &$args) {
    +          case 'Upsert':
    +            $this->driverClasses[$class] = Upsert::class;
    +            break;
    +        }
    

    To maintain the old behaviour we need a default here too :)

    Something like

    default:
      $this->driverClasses[$class] = $class;
    
  2. +++ b/core/modules/system/tests/modules/driver_test/src/Driver/Database/DrivertestNoCustomClassesMysql/Connection.php
    @@ -0,0 +1,19 @@
    +<?php
    +
    +namespace Drupal\driver_test\Driver\Database\DrivertestNoCustomClassesMysql;
    +
    +use Drupal\Core\Database\Driver\mysql\Connection as CoreConnection;
    +
    +/**
    + * MySQL test implementation of \Drupal\Core\Database\Connection.
    + */
    +class Connection extends CoreConnection {
    +
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function driver() {
    +    return 'DrivertestNoCustomClassesMysql';
    +  }
    +
    +}
    

    I'm not convinced that adding this driver is really worthwhile - we can test one of the other test drivers just as well. If the class fallback code was not working everything would be broken. I think it might more important to test that a driver can override the core defaults.

  3. +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php
    @@ -33,10 +33,14 @@ protected function setUpSettings() {
    -    $elements = $this->xpath('//label[@for="edit-driver-drivertestmysql"]');
    -    $this->assertEqual(current($elements)->getText(), 'MySQL by the driver_test module');
    -    $elements = $this->xpath('//label[@for="edit-driver-drivertestpgsql"]');
    -    $this->assertEqual(current($elements)->getText(), 'PostgreSQL by the driver_test module');
    +    if ($driver == 'mysql') {
    +      $elements = $this->xpath('//label[@for="edit-driver-drivertestmysql"]');
    +      $this->assertEqual(current($elements)->getText(), 'MySQL by the driver_test module');
    +    }
    +    if ($driver == 'pgsql') {
    +      $elements = $this->xpath('//label[@for="edit-driver-drivertestpgsql"]');
    +      $this->assertEqual(current($elements)->getText(), 'PostgreSQL by the driver_test module');
    +    }
    

    Is this change actually necessary - I can't see why.

  4. +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php
    @@ -186,4 +186,49 @@ public function testCondition() {
    +    if (Database::getConnection()->driver() != 'mysql') {
    +      $this->markTestSkipped("This test only runs for MySQL");
    +    }
    

    How come we do this? As far as I can see this test is db driver independent.

daffie’s picture

Status: Needs work » Needs review
StatusFileSize
new20.48 KB
new1.59 KB

@alexpott: Thank you for the review.

For #17.1: Fixed.

For #17.2: With the added driver we can test all default classes. With existing drivers that is not possible.

For #17.3: Fixed.

For #17.4: The test will fail for regular driver because they have one or more custom driver classes. This test will test all default driver classes. We only need to test for one driver, because the method we are testing lives in Drupal\Core\Database\Connection and therefor is driver independent.

alexpott’s picture

Re #17.4 but say we removed mysql testing... unlikely yes... but this test should be independent of the DB driver. I agree we only need to test this once but that's the same for 99% of unit tests already. And we don't do that. That's not how our orthogonal tests of each DB driver work atm.

alexpott’s picture

Also for #17.2 well my point is that

If the class fallback code was not working everything would be broken. I think it might more important to test that a driver can override the core defaults.

Plus we're missing test coverage of #17.1 - I thought this was important for SelectExtenders but looking at \Drupal\Core\Database\Query\Select::extend() the way in which we allow drivers to override select extenders is completely wrong and pre namespaces. Ho hum. We need an issue for that too :(

alexpott’s picture

Oh compare \Drupal\Core\Database\Query\Select::extend() and \Drupal\Core\Database\Query\SelectExtender::extend() - that's an interesting difference. Anyhow looking for a class of $this->connectionOptions['namespace'] . '\\' . \Drupal\search\SearchQuery' . ; is amusing...

I wonder what actually is happening in the following code:

    $query = $this->database
      ->select('search_index', 'i')
      // Restrict the search to the current interface language.
      ->condition('i.langcode', $this->languageManager->getCurrentLanguage()->getId())
      ->extend(SearchQuery::class)
      ->extend(PagerSelectExtender::class);

from \Drupal\help_topics\Plugin\Search\HelpSearch::findResults().

daffie’s picture

StatusFileSize
new18.74 KB
new34.73 KB

Added support in Connection->getDriverClass for PagerSelectExtender and TableSortExtender. I did not do the same for SearchQuery, because that class lives in the search module and not in \Drupal\Core. Maybe we should create a followup to fix that.

For #19: You are right. Moved the testing to UnitTesting.

For #20: Fixed. Added testing for: PagerSelectExtender, TableSortExtender and SearchQuery.

For #21: The class PagerSelectExtender overrides the following methods: __construct(), execute(), ensureElement(), setCountQuery(), getCountQuery(), limit() and element()
The class TableSortExtender overrides the following methods: __construct() and orderByHeader().
The __construct() methods only add a "tag" to the query ('pager' and 'tablesort').
There is no overlap between the 2 classes. I think that is way it works.

daffie’s picture

StatusFileSize
new558 bytes
new34.65 KB

Forgot to remove some testing/development stuff.

johnwebdev’s picture

Just minor random thoughts:

  1. +++ b/core/lib/Drupal/Core/Database/Connection.php
    @@ -871,11 +880,50 @@ protected function expandArguments(&$query, &$args) {
    +        switch ($class) {
    +          case 'Condition':
    ...
    +          case 'Delete':
    ...
    +          case 'Insert':
    

    We could use an array lookup table here instead. It pairs nice with the Null coalescing operator. Although, this is just plainly for the "easier on the eye" reason.

  2. +++ b/core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php
    @@ -46,18 +44,16 @@ public function resetLoggedStatements() {
    +      $this->connectionOptions['namespace'] = (new \ReflectionClass(get_parent_class($this)))->getNamespaceName();
    +      $fixed_namespace = TRUE;
    

    This feels wrong. A getter shouldn't set a value. It is a test class though, so maybe it's fine.

  3. +++ b/core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Condition.php
    @@ -0,0 +1,9 @@
    +class Condition extends QueryCondition {
    
    +++ b/core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Connection.php
    @@ -0,0 +1,14 @@
    +class Connection extends BaseConnection {
    
    +++ b/core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Select.php
    @@ -0,0 +1,9 @@
    +class Select extends QuerySelect {
    
    +++ b/core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/TableSortExtender.php
    @@ -0,0 +1,9 @@
    +class TableSortExtender extends QueryTableSortExtender {
    

    Here we need docblocks. There are more occurences.

daffie’s picture

StatusFileSize
new10.53 KB
new37.2 KB

@johnwebdav: Thank you for the review.

For 24.1: I do not fully understand what you want to do and how it then would be "easier on the eye". Feel free to update the patch and make that it so.

For 24.2: The module "database_statement_monitoring_test" is only used in the test Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest. The whole test including the named module can use an update/rewrite. The reflection part was already part of the test and in Drupal\Core\Database\Connection::__construct() we also use something similar ($connection_options['namespace'] = (new \ReflectionObject($this))->getNamespaceName();). We are trying to remove the reflection stuff. For that we need to have one namespace formula for every database driver. Now we have 3 different ones and trying to get rid of 2 of those #3123461: Deprecate support for database drivers placed in DRUPAL_ROOT/drivers and #3129043: Move core database drivers to modules of their own. Hopefully in Drupal 10.0 will get to remove the reflection stuff.

For 24.3: Fixed.

johnwebdev’s picture

#25.1

Something like:

$lookup = [
	'Condition' => Condition:class,
	'Delete' => Delete::class,
	'Upsert' => Upsert::class,
];

$this->driverClasses[$class] = $lookup[$class] ?? $class;

return $this->driverClass;

This is just a preference (and why I only suggested it) I don't think we use this pattern that much in core either.

Let's leave it as is :)

#25.2 I'm not that bothered with the reflections parts per se, I'm just pointing out that our getter method is producing side-effects. This is generally a bad practise, in this case it's in a test, but I'll leave it to other reviewers to have their say if that's something that should be changed.

johnwebdev’s picture

Status: Needs review » Reviewed & tested by the community

I missed that #24.2 was actually pointed out as a suggested change in earlier reviews, and as I was unsure myself, I feel ok to not pursue the discussion.

Interdiff in #25 looks good.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/lib/Drupal/Core/Database/Connection.php
    @@ -871,11 +880,50 @@ protected function expandArguments(&$query, &$args) {
    +          case 'PagerSelectExtender':
    +            $this->driverClasses[$class] = PagerSelectExtender::class;
    +            break;
    ...
    +          case 'TableSortExtender':
    +            $this->driverClasses[$class] = TableSortExtender::class;
    +            break;
    

    It never gets called with these. We shouldn't add these here. We need to open up a follow-up issue about select extenders and database overrides. There differences between \Drupal\Core\Database\Query\Select::extend() and \Drupal\Core\Database\Query\SelectExtender::extend() are problematic and the implementations are BOTH problematic!

    In the case of these classes the calls are always made with ->extend('Drupal\Core\Database\Query\PagerSelectExtender') or ->extend('Drupal\Core\Database\Query\TableSortExtender') so this represents new functionality that's not really supported and makes it look like things will work that don't.

  2. +++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
    @@ -134,23 +134,176 @@ public function providerGetDriverClass() {
    +      // The following test cases are for BC reasons.
    

    This is not true. It's not BC - it's expected functionality.

  3. Whilst checking want we call getDriverClass with discovered we need yet another follow-up for...
    <code>
      /**
       * {@inheritdoc}
       */
      public function upsert($table, array $options = []) {
        // Use the (faster) native Upsert implementation for PostgreSQL >= 9.5.
        if (version_compare($this->version(), '9.5', '>=')) {
          $class = $this->getDriverClass('NativeUpsert');
        }
        else {
          $class = $this->getDriverClass('Upsert');
        }
    
        return new $class($this, $table, $options);
      }
    

    There's no need for the NativeUpsert class anymore. It should become postgres's upsert class.

daffie’s picture

Status: Needs work » Needs review
StatusFileSize
new4.36 KB
new34.48 KB

For #28.1 and #28.2: Fixed.

johnwebdev’s picture

Status: Needs review » Reviewed & tested by the community

Interdiff looks good and follow ups has been created. Pre-Re-RTBC.

alexpott’s picture

Issue summary: View changes

Fixing the issue summary and adding a change record.

alexpott’s picture

I’d like to commit this - but it’s removing all the core db driver specific useless classes. Note we can’t deprecate them because they’ll be used by core. I see a couple of options here:

  • Commit to 9.0.x with the removal and update the CR to reflect this - custom / contrib db drivers are rare and painful because of things like this.
  • Add back the core classes add an @deprecated but not an @trigger_error() and commit to 9.1.x and file an issue to remove them in 10.0.x
  • Add class aliases for all the deprecated classes and commit to 9.1.x and file an issue to remove this class aliases in 10.0.x (as an aside I think we should think about having a deprecated alias class loader than can alias classes and trigger a deprecation)

Any thoughts?

daffie’s picture

Issue summary: View changes

My preference would be to go with the first option. There are only 2 contrib database drivers that are/will extend one of the by core supported database drivers. The first is https://www.drupal.org/project/mysql56 and it is done by @effulgentsia. The second is https://www.drupal.org/project/pgsql_fallback and is done by myself. I think that both @effulgentsia and myself can update our projects before the release of 9.0.0.

@alexpott: Thank you for adding the CR and updating the IS.

catch’s picture

Given only two projects are affected let's remove the redundant classes in 9.0.x. The inability to properly deprecate them is not great, and we also can't do that for class_alias.

xjm’s picture

Issue tags: +beta target, +rc deadline

We should try to do this before RC though.

alexpott’s picture

Issue summary: View changes
Issue tags: +9.0.0 release notes

Added the removed classes to the issue summary.

mondrake’s picture

+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -4,6 +4,13 @@
 
 use Drupal\Component\Assertion\Inspector;
 use Drupal\Core\Database\Query\Condition;
+use Drupal\Core\Database\Query\Delete;
+use Drupal\Core\Database\Query\Insert;
+use Drupal\Core\Database\Query\Merge;
+use Drupal\Core\Database\Query\Select;
+use Drupal\Core\Database\Query\Truncate;
+use Drupal\Core\Database\Query\Update;
+use Drupal\Core\Database\Query\Upsert;
 
 /**
  * Base Database API class.
@@ -871,11 +878,44 @@ protected function expandArguments(&$query, &$args) {

@@ -871,11 +878,44 @@ protected function expandArguments(&$query, &$args) {
   public function getDriverClass($class) {
     if (empty($this->driverClasses[$class])) {
       $driver_class = $this->connectionOptions['namespace'] . '\\' . $class;
-      $this->driverClasses[$class] = class_exists($driver_class) ? $driver_class : $class;
-      if ($this->driverClasses[$class] === 'Condition') {
-        // @todo Deprecate the fallback for contrib and custom drivers in 9.1.x
-        //   in https://www.drupal.org/project/drupal/issues/3120036.
-        $this->driverClasses[$class] = Condition::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 '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;
+        }
       }
     }

wouldn't sth like

+      if (class_exists($driver_class)) {
+        $this->driverClasses[$class] = $driver_class;
+      }
+      else {
+        $this->driverClasses[$class] = __NAMESPACE__ . '\Query\' . $class;
+      }

be simpler (maybe with additional check that the class exists)?

alexpott’s picture

Version: 9.1.x-dev » 9.0.x-dev
Status: Reviewed & tested by the community » Fixed

Committed a11ed7a and pushed to 9.1.x. Thanks!

Also cherry-picked back to 9.0.x.

diff --git a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
index 40c45f40a1..528e248b95 100644
--- a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
@@ -241,32 +241,32 @@ public function providerGetDriverClass() {
       [
         'Drupal\Core\Database\Query\PagerSelectExtender',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        'Drupal\Core\Database\Query\PagerSelectExtender'
+        'Drupal\Core\Database\Query\PagerSelectExtender',
       ],
       [
         '\Drupal\Core\Database\Query\PagerSelectExtender',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        '\Drupal\Core\Database\Query\PagerSelectExtender'
+        '\Drupal\Core\Database\Query\PagerSelectExtender',
       ],
       [
         'Drupal\Core\Database\Query\TableSortExtender',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        'Drupal\Core\Database\Query\TableSortExtender'
+        'Drupal\Core\Database\Query\TableSortExtender',
       ],
       [
         '\Drupal\Core\Database\Query\TableSortExtender',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        '\Drupal\Core\Database\Query\TableSortExtender'
+        '\Drupal\Core\Database\Query\TableSortExtender',
       ],
       [
         'Drupal\search\SearchQuery',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        'Drupal\search\SearchQuery'
+        'Drupal\search\SearchQuery',
       ],
       [
         '\Drupal\search\SearchQuery',
         'Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses',
-        '\Drupal\search\SearchQuery'
+        '\Drupal\search\SearchQuery',
       ],
     ];
   }

Fixed the coding standards on commit.

  • alexpott committed a11ed7a on 9.1.x
    Issue #3124354 by daffie, abhisekmazumdar, alexpott, johnwebdev, catch,...

  • alexpott committed 258fd5e on 9.0.x
    Issue #3124354 by daffie, abhisekmazumdar, alexpott, johnwebdev, catch,...
daffie’s picture

+      if (class_exists($driver_class)) {
+        $this->driverClasses[$class] = $driver_class;
+      }
+      else {
+        $this->driverClasses[$class] = __NAMESPACE__ . '\Query\' . $class;
+      }

@mondrake: This does not work, because not all the classes live in the namespace Drupal\Core\Database\Query, like the Schema class that lives in the namespace Drupal\Core\Database.

Thanks to everybody that helped getting this issue to land!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.