From 5c9c5519f365d56b9c51354728b67a8247158e1b Mon Sep 17 00:00:00 2001 From: Sunny Side Up Date: Sun, 8 Sep 2024 12:21:22 +1200 Subject: [PATCH] FIX: equate empty string to null for more intuitive results --- src/ORM/Filters/SearchFilterable.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ORM/Filters/SearchFilterable.php b/src/ORM/Filters/SearchFilterable.php index c736eee5b..ff145039b 100644 --- a/src/ORM/Filters/SearchFilterable.php +++ b/src/ORM/Filters/SearchFilterable.php @@ -40,7 +40,18 @@ trait SearchFilterable $filterServiceName = "DataListFilter.{$secondArg}"; } } + if (is_array($value)) { + foreach ($value as $key => $val) { + if ($val === '' || $val === 'null') { + $value[] = null; + } + } + } else { + if ($value === '' || $value === 'null') { + $value = ['', null]; + } + } // Build instance return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers); }