From 5d0d3ed09305cfdc5cdc22bd039a85eeecaf3e40 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Mon, 4 May 2020 17:12:04 +0100 Subject: [PATCH] Issue #3128761 by Beakerboy, daffie, alexpott, xjm: Duplicate timestamp placeholder in statistics query (cherry picked from commit 07dd3e2ce718a66d2e2f549b1759ea230152d6be) --- .../src/Plugin/migrate/destination/NodeCounter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php index eee23bff5fa6..1045e4ac8c20 100644 --- a/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php @@ -96,7 +96,10 @@ public function import(Row $row, array $old_destination_id_values = []) { ]) ->expression('daycount', 'daycount + :daycount', [':daycount' => $daycount]) ->expression('totalcount', 'totalcount + :totalcount', [':totalcount' => $totalcount]) - ->expression('timestamp', 'CASE WHEN timestamp > :timestamp THEN timestamp ELSE :timestamp END', [':timestamp' => $timestamp]) + // Per Drupal policy: "A query may have any number of placeholders, but + // all must have unique names even if they have the same value." + // https://www.drupal.org/docs/8/api/database-api/static-queries#placeholders + ->expression('timestamp', 'CASE WHEN timestamp > :timestamp1 THEN timestamp ELSE :timestamp2 END', [':timestamp1' => $timestamp, ':timestamp2' => $timestamp]) ->execute(); return [$row->getDestinationProperty('nid')]; -- GitLab