Skip to content

Commit

Permalink
FilterProcessor: Assemble HasValue & HasNotValue filter rules pre…
Browse files Browse the repository at this point in the history
…dicate
  • Loading branch information
yhabteab committed Nov 15, 2021
1 parent a28c024 commit a9f2d09
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Compat/FilterProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ public static function assemblePredicate(Filter\Condition $filter)
($filter instanceof Filter\Equal || $filter instanceof Filter\Unequal)
&& strpos($expression, '*') !== false
) {
if ($expression === '*') {
return ["$column IS " . ($filter instanceof Filter\Equal ? 'NOT ' : '') . 'NULL'];
} elseif ($filter instanceof Filter\Unequal) {
if ($filter instanceof Filter\Unequal) {
return ["($column NOT LIKE ? OR $column IS NULL)" => str_replace('*', '%', $expression)];
} else {
return ["$column LIKE ?" => str_replace('*', '%', $expression)];
}
} elseif ($filter instanceof Filter\Unequal) {
return ["($column != ? OR $column IS NULL)" => $expression];
} elseif ($filter instanceof Filter\HasNotValue) {
return ["$column IS NULL"];
} elseif ($filter instanceof Filter\HasValue) {
return ["$column IS NOT NULL"];
} else {
if ($filter instanceof Filter\Equal) {
$operator = '=';
Expand Down

0 comments on commit a9f2d09

Please sign in to comment.