Skip to content

Commit

Permalink
Issue #3128761 by Beakerboy, daffie, alexpott, xjm: Duplicate timesta…
Browse files Browse the repository at this point in the history
…mp placeholder in statistics query

(cherry picked from commit 07dd3e2ce718a66d2e2f549b1759ea230152d6be)
  • Loading branch information
alexpott committed May 4, 2020
1 parent c12f3b7 commit 99fc0a9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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')];
Expand Down

0 comments on commit 99fc0a9

Please sign in to comment.