mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
add validation to aggregator and filters
This commit is contained in:
@@ -22,6 +22,9 @@ namespace Chill\PersonBundle\Export\Aggregator;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,6 +33,17 @@ use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
*/
|
||||
class AgeAggregator implements AggregatorInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct($translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
|
||||
public function addRole()
|
||||
{
|
||||
@@ -67,7 +81,7 @@ class AgeAggregator implements AggregatorInterface
|
||||
}
|
||||
|
||||
if ($value === NULL) {
|
||||
return "no data";
|
||||
return $this->translator->trans("without data");
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
@@ -160,7 +160,7 @@ class CountryOfBirthAggregator implements AggregatorInterface
|
||||
|
||||
// initialize array and add blank key for null values
|
||||
$labels[''] = $this->translator->trans('without data');
|
||||
$labels['_header'] = $this->translator->trans('Nationality');
|
||||
$labels['_header'] = $this->translator->trans('Country of birth');
|
||||
foreach($countries as $row) {
|
||||
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class CountryOfBirthAggregator implements AggregatorInterface
|
||||
'NA' => $this->translator->trans('North America'),
|
||||
'OC' => $this->translator->trans('Oceania'),
|
||||
'' => $this->translator->trans('without data'),
|
||||
'_header' => $this->translator->trans('Continent')
|
||||
'_header' => $this->translator->trans('Continent of birth')
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user