From 891c4684e240d36b4b7c15661a490c01fbe67763 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 6 Dec 2020 08:31:23 -0500 Subject: [PATCH] Update DatabaseQuerySelectFulltext to use globally unique bind keys to allow for resulting queries to be merged with AND conditions and without potentially overwriting each other --- wire/core/DatabaseQuerySelectFulltext.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wire/core/DatabaseQuerySelectFulltext.php b/wire/core/DatabaseQuerySelectFulltext.php index 2084b5c2..0cdf89ec 100644 --- a/wire/core/DatabaseQuerySelectFulltext.php +++ b/wire/core/DatabaseQuerySelectFulltext.php @@ -325,6 +325,7 @@ class DatabaseQuerySelectFulltext extends Wire { */ protected function matchArrayFieldName(array $fieldNames, $value) { $query = $this->query; + $query->bindOption('global', true); $this->query = $this->wire(new DatabaseQuerySelect()); $this->query->bindOption(true, $query->bindOption(true)); @@ -332,7 +333,7 @@ class DatabaseQuerySelectFulltext extends Wire { $this->matchFieldName($fieldName, $value); } - $query->where('(' . implode(') OR (', $this->query->where) . ')'); + $query->where('((' . implode(') OR (', $this->query->where) . '))'); $this->query->copyBindValuesTo($query); $this->query = $query; } @@ -358,6 +359,7 @@ class DatabaseQuerySelectFulltext extends Wire { // if($this->operator === '*=') $this->operator = '%='; $query = $this->query; + $query->bindOption('global', true); $this->query = $this->wire(new DatabaseQuerySelect()); $this->query->bindOption(true, $query->bindOption(true)); $method = $this->method; @@ -368,7 +370,7 @@ class DatabaseQuerySelectFulltext extends Wire { } // @todo need to get anything else from substitute query? - $query->where('(' . implode(') OR (', $this->query->where) . ')'); + $query->where('((' . implode(') OR (', $this->query->where) . '))'); $this->query->copyBindValuesTo($query); $this->query = $query; }