Skip to content

Commit

Permalink
FIX: equate empty string to null for more intuitive results
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnysideup committed Sep 8, 2024
1 parent b13b657 commit 5c9c551
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ORM/Filters/SearchFilterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ protected function createSearchFilter($filter, $value)
$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);
}
Expand Down

0 comments on commit 5c9c551

Please sign in to comment.