mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix nationality aggregator
This commit is contained in:
parent
20949fdb5c
commit
6eddb420cc
@ -14,6 +14,7 @@ namespace Chill\MainBundle\Repository;
|
||||
use Chill\MainBundle\Entity\Country;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class CountryRepository implements ObjectRepository
|
||||
@ -25,6 +26,11 @@ final class CountryRepository implements ObjectRepository
|
||||
$this->repository = $entityManager->getRepository(Country::class);
|
||||
}
|
||||
|
||||
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
|
||||
{
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
|
||||
public function find($id, $lockMode = null, $lockVersion = null): ?Country
|
||||
{
|
||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||
|
@ -124,17 +124,19 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
||||
->getQuery()
|
||||
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
|
||||
|
||||
|
||||
// initialize array and add blank key for null values
|
||||
$labels = [
|
||||
'' => $this->translator->trans('without data'),
|
||||
'_header' => $this->translator->trans('Nationality'),
|
||||
];
|
||||
|
||||
|
||||
foreach ($countries as $row) {
|
||||
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ('continent' === $data['group_by_level']) {
|
||||
$labels = [
|
||||
'EU' => $this->translator->trans('Europe'),
|
||||
@ -149,9 +151,10 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
||||
];
|
||||
}
|
||||
|
||||
return static function (string $value) use ($labels): string {
|
||||
return function ($value) use ($labels): string {
|
||||
return $labels[$value];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user