diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-11-19 11:53:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 11:53:41 +0100 |
commit | 8add306204f2ad331dafe091bb9d168ce7781df7 (patch) | |
tree | 109a91745ba45ae886222d2e34b9491a2d0d3b00 /src/Wallabag/CoreBundle/Form/Type | |
parent | b060fbdfe763bf4fa2b17d43bccc6751cefd0d2c (diff) | |
parent | d215273c65ed7aecf0a1f887c91752eaf41d191b (diff) | |
download | wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.tar.gz wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.tar.zst wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.zip |
Merge pull request #2601 from wallabag/store-http-status
Added http_status in Entry entity
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 3c597b5d..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; | |||
11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; | 11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; |
12 | use Symfony\Component\Form\AbstractType; | 12 | use Symfony\Component\Form\AbstractType; |
13 | use Symfony\Component\Form\FormBuilderInterface; | 13 | use Symfony\Component\Form\FormBuilderInterface; |
14 | use Symfony\Component\HttpFoundation\Response; | ||
14 | use Symfony\Component\OptionsResolver\OptionsResolver; | 15 | use Symfony\Component\OptionsResolver\OptionsResolver; |
15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | 16 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
16 | 17 | ||
@@ -90,6 +91,21 @@ class EntryFilterType extends AbstractType | |||
90 | }, | 91 | }, |
91 | 'label' => 'entry.filters.domain_label', | 92 | 'label' => 'entry.filters.domain_label', |
92 | ]) | 93 | ]) |
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 | }, | ||
107 | 'label' => 'entry.filters.http_status_label', | ||
108 | ]) | ||
93 | ->add('isArchived', CheckboxFilterType::class, [ | 109 | ->add('isArchived', CheckboxFilterType::class, [ |
94 | 'label' => 'entry.filters.archived_label', | 110 | 'label' => 'entry.filters.archived_label', |
95 | ]) | 111 | ]) |