X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FFilter%2FEntryFilterType.php;h=771daef1799edb9c02637570a82b89877e93bbac;hb=refs%2Fpull%2F1383%2Fhead;hp=d1057fb56f7d9a4a6231fd11e2cdf70a9d6c71e9;hpb=34437f408c5b7b590aded6795d7ce01bfbfc7711;p=github%2Fwallabag%2Fwallabag.git 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; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; class EntryFilterType extends AbstractType @@ -17,26 +16,29 @@ class EntryFilterType extends AbstractType ->add('createdAt', 'filter_date_range', array( 'left_date_options' => array( 'attr' => array( - 'placeholder' => 'dd/mm/yyyy'), + 'placeholder' => 'dd/mm/yyyy', + ), 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text' + 'widget' => 'single_text', ), 'right_date_options' => array( 'attr' => array( - 'placeholder' => 'dd/mm/yyyy'), + 'placeholder' => 'dd/mm/yyyy', + ), 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text' - ))) + 'widget' => 'single_text', + ), + )) ->add('domainName', 'filter_text', array( - 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) - { + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $value = $values['value']; if (strlen($value) <= 3 || empty($value)) { - return null; + return; } $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); + return $filterQuery->createCondition($expression); - } + }, )); } @@ -48,8 +50,8 @@ class EntryFilterType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'csrf_protection' => false, - 'validation_groups' => array('filtering') + 'csrf_protection' => false, + 'validation_groups' => array('filtering'), )); } }