Skip to content

Commit

Permalink
[AppBundle] Fixed TextFilter not working when used with the value '0' (
Browse files Browse the repository at this point in the history
…#1159)

* [AppBundle] Fixed TextFilter not working when used with the value '0'

* [AppBundle] Fixed OptionFilter not working with value '0'
  • Loading branch information
FabianLiebl committed Feb 9, 2021
1 parent ae4e377 commit 518d4dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Enhavo/Bundle/AppBundle/Filter/Type/OptionType.php
Expand Up @@ -44,7 +44,7 @@ private function formatChoices($options)

public function buildQuery(FilterQuery $query, $options, $value)
{
if($value == '') {
if($value === null || trim($value) === '') {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Enhavo/Bundle/AppBundle/Filter/Type/TextType.php
Expand Up @@ -42,9 +42,9 @@ public function buildQuery(FilterQuery $query, $options, $value)
}
}
}

$operator = $options['operator'];
if($value) {
if($value !== null && trim($value) !== '') {
$query->addWhere($property, $operator, $value, $joinProperty ? $joinProperty : null);
}
}
Expand Down

0 comments on commit 518d4dd

Please sign in to comment.