mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
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
This commit is contained in:
@@ -325,6 +325,7 @@ class DatabaseQuerySelectFulltext extends Wire {
|
|||||||
*/
|
*/
|
||||||
protected function matchArrayFieldName(array $fieldNames, $value) {
|
protected function matchArrayFieldName(array $fieldNames, $value) {
|
||||||
$query = $this->query;
|
$query = $this->query;
|
||||||
|
$query->bindOption('global', true);
|
||||||
$this->query = $this->wire(new DatabaseQuerySelect());
|
$this->query = $this->wire(new DatabaseQuerySelect());
|
||||||
$this->query->bindOption(true, $query->bindOption(true));
|
$this->query->bindOption(true, $query->bindOption(true));
|
||||||
|
|
||||||
@@ -332,7 +333,7 @@ class DatabaseQuerySelectFulltext extends Wire {
|
|||||||
$this->matchFieldName($fieldName, $value);
|
$this->matchFieldName($fieldName, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->where('(' . implode(') OR (', $this->query->where) . ')');
|
$query->where('((' . implode(') OR (', $this->query->where) . '))');
|
||||||
$this->query->copyBindValuesTo($query);
|
$this->query->copyBindValuesTo($query);
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
}
|
}
|
||||||
@@ -358,6 +359,7 @@ class DatabaseQuerySelectFulltext extends Wire {
|
|||||||
// if($this->operator === '*=') $this->operator = '%=';
|
// if($this->operator === '*=') $this->operator = '%=';
|
||||||
|
|
||||||
$query = $this->query;
|
$query = $this->query;
|
||||||
|
$query->bindOption('global', true);
|
||||||
$this->query = $this->wire(new DatabaseQuerySelect());
|
$this->query = $this->wire(new DatabaseQuerySelect());
|
||||||
$this->query->bindOption(true, $query->bindOption(true));
|
$this->query->bindOption(true, $query->bindOption(true));
|
||||||
$method = $this->method;
|
$method = $this->method;
|
||||||
@@ -368,7 +370,7 @@ class DatabaseQuerySelectFulltext extends Wire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @todo need to get anything else from substitute query?
|
// @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->copyBindValuesTo($query);
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user