small refactorisations

This commit is contained in:
Julie Lenaerts 2022-08-16 15:13:47 +02:00
parent 4c91bf5084
commit 2c53f92a2e
3 changed files with 9 additions and 3 deletions

View File

@ -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',

View File

@ -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 = [

View File

@ -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()