diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php index 5af99be5a..3e9366673 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Serializer\Normalizer; use Chill\MainBundle\Entity\Gender; -use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; @@ -21,7 +21,7 @@ class GenderDocGenNormalizer implements ContextAwareNormalizerInterface, Normali { use NormalizerAwareTrait; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function supportsNormalization($data, ?string $format = null, array $context = []) { diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 784e0ab02..0f042691d 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -95,7 +95,7 @@ class PersonDocGenNormalizer implements 'age' => (int) $person->getAge(), 'birthdate' => $this->normalizer->normalize($person->getBirthdate(), $format, $dateContext), 'deathdate' => $this->normalizer->normalize($person->getDeathdate(), $format, $dateContext), - 'gender' => $this->translatableStringHelper->localize($person->getGender()->getLabel()), + 'gender' => null !== ($g = $person->getGender()) ? $this->translatableStringHelper->localize($g->getLabel()) : '', 'genderEntity' => $this->normalizer->normalize($person->getGender(), $format, $genderContext), 'maritalStatus' => null !== ($ms = $person->getMaritalStatus()) ? $this->translatableStringHelper->localize($ms->getName()) : '', 'maritalStatusDate' => $this->normalizer->normalize($person->getMaritalStatusDate(), $format, $dateContext),