From 5d7e8d99521a167c81f10c4ebfddb71b87f18081 Mon Sep 17 00:00:00 2001 From: Dmytro Kharchenko Date: Fri, 30 May 2025 18:41:52 +0300 Subject: [PATCH 1/2] DimX / add support for 'IN' comparison operator in condition class / --- lib/Skeleton/Pager/Sql/Condition.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Skeleton/Pager/Sql/Condition.php b/lib/Skeleton/Pager/Sql/Condition.php index d735fcb..9c09d5f 100644 --- a/lib/Skeleton/Pager/Sql/Condition.php +++ b/lib/Skeleton/Pager/Sql/Condition.php @@ -303,6 +303,12 @@ public function evaluate($value) { } } return false; + case 'IN': + case 'in': + if (in_array($value, $this->value) === true) { + return true; + } + return false; default: throw new \Exception("Unsupported comparison operator: '" . $this->comparison . "'"); } From 69d0f703ed51d4f60c98f5992fd7b91941f639fc Mon Sep 17 00:00:00 2001 From: Dmytro Kharchenko Date: Sat, 31 May 2025 12:30:36 +0300 Subject: [PATCH 2/2] DimX / add case-insensitive support for 'IN' and 'NOT IN' comparison operators in condition evaluation / --- lib/Skeleton/Pager/Sql/Condition.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Skeleton/Pager/Sql/Condition.php b/lib/Skeleton/Pager/Sql/Condition.php index 9c09d5f..d8459a5 100644 --- a/lib/Skeleton/Pager/Sql/Condition.php +++ b/lib/Skeleton/Pager/Sql/Condition.php @@ -258,7 +258,7 @@ public function equals(\Skeleton\Pager\Sql\Condition $condition) { * @return bool */ public function evaluate($value) { - switch ($this->comparison) { + switch (strtolower($this->comparison)) { case '': case '=': foreach ($this->value as $value_item) { @@ -303,7 +303,11 @@ public function evaluate($value) { } } return false; - case 'IN': + case 'not in': + if (in_array($value, $this->value) === false) { + return true; + } + return false; case 'in': if (in_array($value, $this->value) === true) { return true;