diff options
author | Maxime Marinel <m.marinel@motoblouz.com> | 2017-05-03 11:08:56 +0200 |
---|---|---|
committer | Maxime Marinel <m.marinel@motoblouz.com> | 2017-05-03 11:08:56 +0200 |
commit | 1267905d283afc8a0140da007d8428d533964839 (patch) | |
tree | 29d7d0a5cebdbfc43e981c4d1ef294b1e49339e9 | |
parent | a7c8f5457014f5dd6370323e9aad61d0d08848ee (diff) | |
download | wallabag-1267905d283afc8a0140da007d8428d533964839.tar.gz wallabag-1267905d283afc8a0140da007d8428d533964839.tar.zst wallabag-1267905d283afc8a0140da007d8428d533964839.zip |
Disable negative numbers in filters
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index ee66c728..ab27ec8e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | 3 | namespace Wallabag\CoreBundle\Form\Type; |
4 | 4 | ||
5 | use Doctrine\ORM\EntityRepository; | 5 | use Doctrine\ORM\EntityRepository; |
6 | use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; | ||
6 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; | 7 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; |
7 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; | 8 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; |
8 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; | 9 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; |
@@ -41,6 +42,8 @@ class EntryFilterType extends AbstractType | |||
41 | { | 42 | { |
42 | $builder | 43 | $builder |
43 | ->add('readingTime', NumberRangeFilterType::class, [ | 44 | ->add('readingTime', NumberRangeFilterType::class, [ |
45 | 'left_number_options' => ['condition_operator' => FilterOperands::OPERATOR_GREATER_THAN_EQUAL, 'attr' => ['min' => 0]], | ||
46 | 'right_number_options' => ['condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL, 'attr' => ['min' => 0]], | ||
44 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 47 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
45 | $lower = $values['value']['left_number'][0]; | 48 | $lower = $values['value']['left_number'][0]; |
46 | $upper = $values['value']['right_number'][0]; | 49 | $upper = $values['value']['right_number'][0]; |