diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-08-20 07:53:55 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-08-20 07:53:55 +0200 |
commit | 8ce32af61229eec8f4cc34b207273d47f60adc48 (patch) | |
tree | 4d878e6d4eb5c1baab95cd02e3eb95ee4182a399 /src/Wallabag/CoreBundle/Filter/EntryFilterType.php | |
parent | 34437f408c5b7b590aded6795d7ce01bfbfc7711 (diff) | |
download | wallabag-8ce32af61229eec8f4cc34b207273d47f60adc48.tar.gz wallabag-8ce32af61229eec8f4cc34b207273d47f60adc48.tar.zst wallabag-8ce32af61229eec8f4cc34b207273d47f60adc48.zip |
CS
We shouldn't forget to run `php-cs-fixer` time to time
Diffstat (limited to 'src/Wallabag/CoreBundle/Filter/EntryFilterType.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Filter/EntryFilterType.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php index d1057fb5..771daef1 100644 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php | |||
@@ -5,7 +5,6 @@ namespace Wallabag\CoreBundle\Filter; | |||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
8 | use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; | ||
9 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; | 8 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; |
10 | 9 | ||
11 | class EntryFilterType extends AbstractType | 10 | class EntryFilterType extends AbstractType |
@@ -17,26 +16,29 @@ class EntryFilterType extends AbstractType | |||
17 | ->add('createdAt', 'filter_date_range', array( | 16 | ->add('createdAt', 'filter_date_range', array( |
18 | 'left_date_options' => array( | 17 | 'left_date_options' => array( |
19 | 'attr' => array( | 18 | 'attr' => array( |
20 | 'placeholder' => 'dd/mm/yyyy'), | 19 | 'placeholder' => 'dd/mm/yyyy', |
20 | ), | ||
21 | 'format' => 'dd/MM/yyyy', | 21 | 'format' => 'dd/MM/yyyy', |
22 | 'widget' => 'single_text' | 22 | 'widget' => 'single_text', |
23 | ), | 23 | ), |
24 | 'right_date_options' => array( | 24 | 'right_date_options' => array( |
25 | 'attr' => array( | 25 | 'attr' => array( |
26 | 'placeholder' => 'dd/mm/yyyy'), | 26 | 'placeholder' => 'dd/mm/yyyy', |
27 | ), | ||
27 | 'format' => 'dd/MM/yyyy', | 28 | 'format' => 'dd/MM/yyyy', |
28 | 'widget' => 'single_text' | 29 | 'widget' => 'single_text', |
29 | ))) | 30 | ), |
31 | )) | ||
30 | ->add('domainName', 'filter_text', array( | 32 | ->add('domainName', 'filter_text', array( |
31 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) | 33 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
32 | { | ||
33 | $value = $values['value']; | 34 | $value = $values['value']; |
34 | if (strlen($value) <= 3 || empty($value)) { | 35 | if (strlen($value) <= 3 || empty($value)) { |
35 | return null; | 36 | return; |
36 | } | 37 | } |
37 | $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); | 38 | $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); |
39 | |||
38 | return $filterQuery->createCondition($expression); | 40 | return $filterQuery->createCondition($expression); |
39 | } | 41 | }, |
40 | )); | 42 | )); |
41 | } | 43 | } |
42 | 44 | ||
@@ -48,8 +50,8 @@ class EntryFilterType extends AbstractType | |||
48 | public function configureOptions(OptionsResolver $resolver) | 50 | public function configureOptions(OptionsResolver $resolver) |
49 | { | 51 | { |
50 | $resolver->setDefaults(array( | 52 | $resolver->setDefaults(array( |
51 | 'csrf_protection' => false, | 53 | 'csrf_protection' => false, |
52 | 'validation_groups' => array('filtering') | 54 | 'validation_groups' => array('filtering'), |
53 | )); | 55 | )); |
54 | } | 56 | } |
55 | } | 57 | } |