On issues like #1935300: Don't hardwire Database in Views filters, add regexp to DBTNG it became clear that you want to construct the dbtng query object
a bit earlier.

Files: 
CommentFileSizeAuthor
#14 1937414-14.patch8.16 KBjibran
FAILED: [[SimpleTest]]: [MySQL] 57,856 pass(es), 179 fail(s), and 55 exception(s). View
#14 interdiff.txt1.9 KBjibran
#11 interdiff.txt2.99 KBjibran
#7 views-make-select-objection-earlier-available-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 57,891 pass(es). View
#8 views-make-select-objection-earlier-available-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 56,366 pass(es). View
#8 drupal-1937414-1-5-interdiff.txt5.31 KBpwieck
#6 drupal-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 57,902 pass(es). View
#6 drupal-1937414-1-5-interdiff.txt5.31 KBpwieck
#1 drupal-1937414-1.patch4.65 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 55,623 pass(es). View

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
4.65 KB
PASSED: [[SimpleTest]]: [MySQL] 55,623 pass(es). View

Let's give it a try.

dawehner’s picture

#1: drupal-1937414-1.patch queued for re-testing.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

This is all internal reshuffling, and it makes sense.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

curl https://drupal.org/files/drupal-1937414-1_0.patch | git a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4766  100  4766    0     0   4369      0  0:00:01  0:00:01 --:--:--  5385
error: patch failed: core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php:1239
error: core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php: patch does not apply
pwieck’s picture

Working on reroll now.

pwieck’s picture

FileSize
5.31 KB
4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 57,902 pass(es). View

Re-rolled. No conflicts with head.

pwieck’s picture

Status: Needs review » Needs work
FileSize
4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 57,891 pass(es). View

-DISREGARD- Forgot to change status.

pwieck’s picture

Status: Needs work » Needs review
FileSize
5.31 KB
4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 56,366 pass(es). View

Forgot to change status.

pwieck’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Re-roll #8 passed. Needs review. Disregard #6 and #7. I never forgot status before and then made a mess of it.

dawehner’s picture

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1338,6 +1319,35 @@ function alter(ViewExecutable $view) {
+   * Implements \Drupal\views\Plugin\views\query\QueryPluginBase::preQuery().

This line should be {@inheritdoc}

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1338,6 +1319,35 @@ function alter(ViewExecutable $view) {
+    $query = Database::getConnection($target, $key)

It should be even possible to inject the database connection in the constructor?

jibran’s picture

FileSize
2.99 KB
6.91 KB
FAILED: [[SimpleTest]]: [MySQL] 58,149 pass(es), 1 fail(s), and 1 exception(s). View

Fixed #10.

dawehner’s picture

So what about the database connection?

Status: Needs review » Needs work

The last submitted patch, 1937414-11.patch, failed testing.

jibran’s picture

Status: Needs work » Needs review
FileSize
1.9 KB
8.16 KB
FAILED: [[SimpleTest]]: [MySQL] 57,856 pass(es), 179 fail(s), and 55 exception(s). View

Implemented Serializable as per @dawehner suggestion.

So what about the database connection?

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1334,7 +1348,36 @@ public function getWhereArgs() {
+    $query = Database::getConnection($target, $key)

we can't inject because we can't specify database connection.

dawehner’s picture

Status: Needs review » Needs work

The general idea is to not store the database connection in the serialized object, but remove it in serialize() and add it back in unserialize().

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.