From 2c53f92a2ec447e37b19876d46d168b134eb5381 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 15:13:47 +0200 Subject: [PATCH] small refactorisations --- .../Export/Aggregator/PersonAggregators/AgeAggregator.php | 3 ++- .../PersonAggregators/CountryOfBirthAggregator.php | 3 ++- .../Export/Filter/PersonFilters/AgeFilter.php | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index a8f57e022..00dd93a4b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface; use DateTime; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -45,7 +46,7 @@ final class AgeAggregator implements AggregatorInterface, ExportElementValidated return 'person'; } - public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder) { $builder->add('date_age_calculation', DateType::class, [ 'label' => 'Calculate age in relation to this date', diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index f0ae90f12..f54bffd0b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Repository\CountryRepository; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Util\CountriesInfo; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use LogicException; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -122,7 +123,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme ->andWhere($qb->expr()->in('c.countryCode', ':countries')) ->setParameter('countries', $values) ->getQuery() - ->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR); + ->getResult(Query::HYDRATE_SCALAR); // initialize array and add blank key for null values $labels = [ diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index 386b4f8b0..47fb37214 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -81,7 +81,11 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface public function describeAction($data, $format = 'string') { - return ['Filtered by person\'s age']; + return ['Filtered by person\'s age: ' + . 'between %min_age% and %max_age%', [ + '%min_age%' => $data['min_age'], + '%max_age%' => $data['max_age'], + ], ]; } public function getTitle()