aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-18 23:05:02 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-18 23:05:02 +0100
commitd215273c65ed7aecf0a1f887c91752eaf41d191b (patch)
tree109a91745ba45ae886222d2e34b9491a2d0d3b00 /src/Wallabag
parente10e6ab34e62129d57fc69d7b9b69b08c20e6f5a (diff)
downloadwallabag-d215273c65ed7aecf0a1f887c91752eaf41d191b.tar.gz
wallabag-d215273c65ed7aecf0a1f887c91752eaf41d191b.tar.zst
wallabag-d215273c65ed7aecf0a1f887c91752eaf41d191b.zip
Check if status code is OK
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, [