From a9f2d09c80528f23c5dbe6c22d5dc5e21284523a Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Mon, 15 Nov 2021 15:10:58 +0100 Subject: [PATCH] FilterProcessor: Assemble `HasValue` & `HasNotValue` filter rules predicate --- src/Compat/FilterProcessor.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Compat/FilterProcessor.php b/src/Compat/FilterProcessor.php index b6c9bdc..f6c51ac 100644 --- a/src/Compat/FilterProcessor.php +++ b/src/Compat/FilterProcessor.php @@ -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 = '=';