From 8523f14214f522bee60a7d51b8fcab52591e7b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 16 Oct 2023 17:58:22 +0200 Subject: [PATCH] Fix closing motive render --- .../Templating/Entity/ClosingMotiveRender.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php index 558c2eb2c..a70eeb6a7 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php @@ -23,12 +23,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; * * @implements ChillEntityRenderInterface */ -class ClosingMotiveRender implements ChillEntityRenderInterface +final readonly class ClosingMotiveRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; private const SEPARATOR = ' > '; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct( + private TranslatableStringHelper $translatableStringHelper, + private TranslatorInterface $translator + ) {} public function renderBox($entity, array $options): string { @@ -55,7 +58,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface private function renderStringRecursive(ClosingMotive $motive, string $existing, array $options) { $newExisting = $this->translatableStringHelper->localize($motive->getName()); - $isCancled = $motive->getIsCanceledAccompanyingPeriod() ? $this->translator->trans('( Canceled period )') : ''; + $isCanceled = $motive->getIsCanceledAccompanyingPeriod() ? $this->translator->trans('( Canceled period )') : ''; if ($motive->hasParent()) { if ('' !== $existing) { @@ -64,7 +67,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface return $this->renderStringRecursive( $motive->getParent(), - $newExisting . ' ' . $isCancled, + $newExisting . ' ' . $isCanceled, $options ); } @@ -73,6 +76,6 @@ class ClosingMotiveRender implements ChillEntityRenderInterface return $newExisting . self::SEPARATOR . $existing; } - return $newExisting . ' ' . $isCancled; + return $newExisting . ' ' . $isCanceled; } }