Support "old" combined group membership filter in subquery filter chains

This commit is contained in:
Eric Lippmann 2019-07-16 14:24:33 +02:00 committed by Johannes Meyer
parent bee5099a08
commit 0de923fc5f
1 changed files with 21 additions and 8 deletions

View File

@ -703,6 +703,17 @@ abstract class IdoQuery extends DbQuery
$filters = [];
$expressions = [];
foreach ($filter->filters() as $child) {
switch (true) {
case $child instanceof FilterExpression:
$expression = $child->getExpression();
if (! is_array($expression)) {
break;
}
// Move to default
default:
$filters[] = $child;
continue 2;
}
if ($lastSign === null) {
$lastSign = $child->getSign();
} else {
@ -719,15 +730,17 @@ abstract class IdoQuery extends DbQuery
$lastSign = $sign;
}
}
$expressions[] = $child->getExpression();
$expressions[] = $expression;
}
if (! empty($expressions)) {
$filters[] = new FilterExpression(
$column,
$lastSign,
$filter->getOperatorSymbol() === '&'
? [implode('&', $expressions)]
: $expressions
);
}
$filters[] = new FilterExpression(
$column,
$lastSign,
$filter->getOperatorSymbol() === '&'
? [implode('&', $expressions)]
: $expressions
);
$filter->setFilters($filters);
}
}