mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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 Chill\MainBundle\Entity\Country;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
final class CountryRepository implements ObjectRepository
|
final class CountryRepository implements ObjectRepository
|
||||||
@ -25,6 +26,11 @@ final class CountryRepository implements ObjectRepository
|
|||||||
$this->repository = $entityManager->getRepository(Country::class);
|
$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
|
public function find($id, $lockMode = null, $lockVersion = null): ?Country
|
||||||
{
|
{
|
||||||
return $this->repository->find($id, $lockMode, $lockVersion);
|
return $this->repository->find($id, $lockMode, $lockVersion);
|
||||||
|
@ -124,17 +124,19 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
|||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
|
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
|
||||||
|
|
||||||
|
|
||||||
// initialize array and add blank key for null values
|
// initialize array and add blank key for null values
|
||||||
$labels = [
|
$labels = [
|
||||||
'' => $this->translator->trans('without data'),
|
'' => $this->translator->trans('without data'),
|
||||||
'_header' => $this->translator->trans('Nationality'),
|
'_header' => $this->translator->trans('Nationality'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
foreach ($countries as $row) {
|
foreach ($countries as $row) {
|
||||||
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('continent' === $data['group_by_level']) {
|
if ('continent' === $data['group_by_level']) {
|
||||||
$labels = [
|
$labels = [
|
||||||
'EU' => $this->translator->trans('Europe'),
|
'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];
|
return $labels[$value];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user