Adjust gender aggregator

This commit is contained in:
Julie Lenaerts 2024-10-08 16:29:24 +02:00
parent 7520d746e8
commit 9f3893243e

View File

@ -22,7 +22,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final readonly class GenderAggregator implements AggregatorInterface final readonly class GenderAggregator implements AggregatorInterface
{ {
public function __construct(private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, GenderRepository $repository) {} public function __construct(private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private GenderRepository $repository) {}
public function addRole(): ?string public function addRole(): ?string
{ {
@ -31,7 +31,8 @@ final readonly class GenderAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data) public function alterQuery(QueryBuilder $qb, $data)
{ {
$qb->addSelect('person.gender as gender'); $qb->leftJoin('person.gender', 'g');
$qb->addSelect('g.id as gender');
$qb->addGroupBy('gender'); $qb->addGroupBy('gender');
} }