FIX: equate empty string to null for more intuitive results

This commit is contained in:
Sunny Side Up 2024-09-08 12:21:22 +12:00 committed by GitHub
parent b13b657de5
commit 5c9c5519f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,18 @@ trait SearchFilterable
$filterServiceName = "DataListFilter.{$secondArg}"; $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 // Build instance
return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers); return Injector::inst()->create($filterServiceName, $fieldName, $value, $modifiers);
} }