aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index 38321d17..8e2883f7 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -11,6 +11,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
11use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; 11use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
12use Symfony\Component\Form\AbstractType; 12use Symfony\Component\Form\AbstractType;
13use Symfony\Component\Form\FormBuilderInterface; 13use Symfony\Component\Form\FormBuilderInterface;
14use Symfony\Component\HttpFoundation\Response;
14use Symfony\Component\OptionsResolver\OptionsResolver; 15use Symfony\Component\OptionsResolver\OptionsResolver;
15use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 16use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
16 17
@@ -91,6 +92,18 @@ class EntryFilterType extends AbstractType
91 'label' => 'entry.filters.domain_label', 92 'label' => 'entry.filters.domain_label',
92 ]) 93 ])
93 ->add('httpStatus', TextFilterType::class, [ 94 ->add('httpStatus', TextFilterType::class, [
95 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
96 $value = $values['value'];
97 if (false === array_key_exists($value, Response::$statusTexts)) {
98 return;
99 }
100
101 $paramName = sprintf('%s', str_replace('.', '_', $field));
102 $expression = $filterQuery->getExpr()->eq($field, ':'.$paramName);
103 $parameters = array($paramName => $value);
104
105 return $filterQuery->createCondition($expression, $parameters);
106 },
94 'label' => 'entry.filters.http_status_label', 107 'label' => 'entry.filters.http_status_label',
95 ]) 108 ])
96 ->add('isArchived', CheckboxFilterType::class, [ 109 ->add('isArchived', CheckboxFilterType::class, [