From: Maxime Marinel Date: Wed, 3 May 2017 09:08:56 +0000 (+0200) Subject: Disable negative numbers in filters X-Git-Tag: 2.2.3~6^2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=1267905d283afc8a0140da007d8428d533964839;p=github%2Fwallabag%2Fwallabag.git Disable negative numbers in filters --- 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 @@ namespace Wallabag\CoreBundle\Form\Type; use Doctrine\ORM\EntityRepository; +use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; @@ -41,6 +42,8 @@ class EntryFilterType extends AbstractType { $builder ->add('readingTime', NumberRangeFilterType::class, [ + 'left_number_options' => ['condition_operator' => FilterOperands::OPERATOR_GREATER_THAN_EQUAL, 'attr' => ['min' => 0]], + 'right_number_options' => ['condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL, 'attr' => ['min' => 0]], 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $lower = $values['value']['left_number'][0]; $upper = $values['value']['right_number'][0];