aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-05-09 13:56:44 +0200
committerGitHub <noreply@github.com>2017-05-09 13:56:44 +0200
commita2ae05a61ca7aad476a48247a4559c25dd55618d (patch)
tree2bedaed8627fac2a1bf701150c3af57792bff02d /src/Wallabag
parentc829b06ed8f757f2b96515eb872f9ccf20363c94 (diff)
parent1b1647175d7eaa2800a2eff9f984ef37e9976fba (diff)
downloadwallabag-a2ae05a61ca7aad476a48247a4559c25dd55618d.tar.gz
wallabag-a2ae05a61ca7aad476a48247a4559c25dd55618d.tar.zst
wallabag-a2ae05a61ca7aad476a48247a4559c25dd55618d.zip
Merge pull request #3076 from wallabag/hotfix/2979
Disable negative numbers in filters
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index ee66c728..556578d1 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -3,6 +3,7 @@
3namespace Wallabag\CoreBundle\Form\Type; 3namespace Wallabag\CoreBundle\Form\Type;
4 4
5use Doctrine\ORM\EntityRepository; 5use Doctrine\ORM\EntityRepository;
6use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands;
6use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; 7use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
7use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; 8use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType;
8use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; 9use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType;
@@ -33,7 +34,7 @@ class EntryFilterType extends AbstractType
33 $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; 34 $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
34 35
35 if (null === $this->user || !is_object($this->user)) { 36 if (null === $this->user || !is_object($this->user)) {
36 return null; 37 return;
37 } 38 }
38 } 39 }
39 40
@@ -41,6 +42,14 @@ class EntryFilterType extends AbstractType
41 { 42 {
42 $builder 43 $builder
43 ->add('readingTime', NumberRangeFilterType::class, [ 44 ->add('readingTime', NumberRangeFilterType::class, [
45 'left_number_options' => [
46 'condition_operator' => FilterOperands::OPERATOR_GREATER_THAN_EQUAL,
47 'attr' => ['min' => 0],
48 ],
49 'right_number_options' => [
50 'condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL,
51 'attr' => ['min' => 0],
52 ],
44 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 53 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
45 $lower = $values['value']['left_number'][0]; 54 $lower = $values['value']['left_number'][0];
46 $upper = $values['value']['right_number'][0]; 55 $upper = $values['value']['right_number'][0];