diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php index c02867fd..efee3491 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php @@ -4,7 +4,6 @@ namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\FilterData; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -14,19 +13,15 @@ final class BooleanFilterType extends AbstractDoctrineOrmFilterType { - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ 'form_type' => ChoiceType::class, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + ], 'active_filter_formatter' => function (FilterData $data) { return new TranslatableMessage($data->getValue() ? 'Yes' : 'No', domain: 'KreyuDataTable'); }, diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/DateFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/DateFilterType.php index e72c431b..d6e982ec 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/DateFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/DateFilterType.php @@ -5,7 +5,6 @@ namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type; use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Formatter\DateActiveFilterFormatter; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\OptionsResolver\Options; @@ -13,23 +12,19 @@ final class DateFilterType extends AbstractDoctrineOrmFilterType { - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - Operator::GreaterThan, - Operator::GreaterThanEquals, - Operator::LessThan, - Operator::LessThanEquals, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ 'form_type' => DateType::class, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + Operator::GreaterThan, + Operator::GreaterThanEquals, + Operator::LessThan, + Operator::LessThanEquals, + ], 'active_filter_formatter' => new DateActiveFilterFormatter(), ]) ->addNormalizer('form_options', function (Options $options, array $value) { diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/DateTimeFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/DateTimeFilterType.php index 9fd5326a..20098d51 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/DateTimeFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/DateTimeFilterType.php @@ -5,7 +5,6 @@ namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type; use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Formatter\DateTimeActiveFilterFormatter; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; use Symfony\Component\OptionsResolver\Options; @@ -13,23 +12,19 @@ final class DateTimeFilterType extends AbstractDoctrineOrmFilterType { - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - Operator::GreaterThan, - Operator::GreaterThanEquals, - Operator::LessThan, - Operator::LessThanEquals, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ 'form_type' => DateTimeType::class, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + Operator::GreaterThan, + Operator::GreaterThanEquals, + Operator::LessThan, + Operator::LessThanEquals, + ], 'active_filter_formatter' => new DateTimeActiveFilterFormatter(), ]) ->addNormalizer('form_options', function (Options $options, array $value): array { diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/EntityFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/EntityFilterType.php index c2bcd0fe..1b9987c0 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/EntityFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/EntityFilterType.php @@ -6,7 +6,6 @@ use Doctrine\Persistence\ManagerRegistry; use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Formatter\EntityActiveFilterFormatter; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\OptionsResolver\Options; @@ -19,21 +18,17 @@ public function __construct( ) { } - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - Operator::In, - Operator::NotIn, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ 'form_type' => EntityType::class, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + Operator::In, + Operator::NotIn, + ], 'choice_label' => null, 'active_filter_formatter' => new EntityActiveFilterFormatter(), ]) diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/NumericFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/NumericFilterType.php index 1514f2c7..cf55f1e6 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/NumericFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/NumericFilterType.php @@ -4,29 +4,24 @@ namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\OptionsResolver\OptionsResolver; final class NumericFilterType extends AbstractDoctrineOrmFilterType { - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - Operator::Contains, - Operator::NotContains, - Operator::StartsWith, - Operator::EndsWith, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'form_type' => NumberType::class, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + Operator::Contains, + Operator::NotContains, + Operator::StartsWith, + Operator::EndsWith, + ], ]); } } diff --git a/src/Bridge/Doctrine/Orm/Filter/Type/StringFilterType.php b/src/Bridge/Doctrine/Orm/Filter/Type/StringFilterType.php index 5357cc53..4ebbf631 100644 --- a/src/Bridge/Doctrine/Orm/Filter/Type/StringFilterType.php +++ b/src/Bridge/Doctrine/Orm/Filter/Type/StringFilterType.php @@ -4,28 +4,23 @@ namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Filter\Type; -use Kreyu\Bundle\DataTableBundle\Filter\FilterBuilderInterface; use Kreyu\Bundle\DataTableBundle\Filter\Operator; use Symfony\Component\OptionsResolver\OptionsResolver; final class StringFilterType extends AbstractDoctrineOrmFilterType { - public function buildFilter(FilterBuilderInterface $builder, array $options): void - { - $builder->setSupportedOperators([ - Operator::Equals, - Operator::NotEquals, - Operator::Contains, - Operator::NotContains, - Operator::StartsWith, - Operator::EndsWith, - ]); - } - public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'default_operator' => Operator::Contains, + 'supported_operators' => [ + Operator::Equals, + Operator::NotEquals, + Operator::Contains, + Operator::NotContains, + Operator::StartsWith, + Operator::EndsWith, + ], ]); } }