diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index ec15be45f..3d4c1f7cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -12,21 +12,23 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; -use Chill\PersonBundle\Entity\Person; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\MaritalStatusRepository; use Doctrine\ORM\QueryBuilder; -use LogicException; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; + final class MaritalStatusAggregator implements AggregatorInterface { private MaritalStatusRepository $maritalStatusRepository; - public function __construct(MaritalStatusRepository $maritalStatusRepository) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(MaritalStatusRepository $maritalStatusRepository, TranslatableStringHelper $translatableStringHelper) { $this->maritalStatusRepository = $maritalStatusRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -66,7 +68,7 @@ final class MaritalStatusAggregator implements AggregatorInterface $g = $this->maritalStatusRepository->find($value); - return $g->getName()['fr']; + return $this->translatableStringHelper->localize($g->getName()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index 2567ea378..d8f485561 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -12,9 +12,9 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; -use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -22,11 +22,12 @@ final class ActionTypeAggregator implements AggregatorInterface { private SocialActionRepository $socialActionRepository; - private SocialActionRender $socialActionRender; + private TranslatableStringHelper $translatableStringHelper; - public function __construct(SocialActionRepository $socialActionRepository) + public function __construct(SocialActionRepository $socialActionRepository, TranslatableStringHelper $translatableStringHelper) { $this->socialActionRepository = $socialActionRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -69,7 +70,7 @@ final class ActionTypeAggregator implements AggregatorInterface $sa = $this->socialActionRepository->find($value); - return $sa->getTitle()['fr']; + return $this->translatableStringHelper->localize($sa->getTitle()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index d3b277a16..cb908ef3e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\GoalRepository; use Doctrine\ORM\QueryBuilder; @@ -21,9 +22,12 @@ final class GoalAggregator implements AggregatorInterface { private GoalRepository $goalRepository; - public function __construct(GoalRepository $goalRepository) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(GoalRepository $goalRepository, TranslatableStringHelper $translatableStringHelper) { $this->goalRepository = $goalRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -65,7 +69,7 @@ final class GoalAggregator implements AggregatorInterface $g = $this->goalRepository->find($value); - return $g->getTitle()['fr']; + return $this->translatableStringHelper->localize($g->getTitle()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 476b6f840..424010138 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -33,8 +33,8 @@ final class ResultAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.results', 'r'); - $qb->addSelect('r.id as result_aggregator'); + $qb->join('acpw.results', 'res'); + $qb->addSelect('res.id as result_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); @@ -65,7 +65,7 @@ final class ResultAggregator implements AggregatorInterface $g = $this->resultRepository->find($value); - return $g->getTitle()['fr']; + return $this->translatableStringHelper->localize($g->getTitle()); }; }