From 1155555bb3ec1c375ef683f13ea355772d305214 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 29 Oct 2021 10:37:51 +0200 Subject: [PATCH] backend: adapt deprecated getGenderNumeric --- src/Bundle/ChillPersonBundle/Entity/Person.php | 14 ++++++++++---- .../Serializer/Normalizer/PersonNormalizer.php | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 9aaad8c04..01a524beb 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -901,13 +901,19 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * return gender as a Numeric form. * This is used for translations * @return int + * @deprecated Keep for legacy. Used in Chill 1.5 for feminize before icu translations */ public function getGenderNumeric() { - if ($this->getGender() == self::FEMALE_GENDER) { - return 1; - } else { - return 0; + switch ($this->getGender()) { + case self::FEMALE_GENDER: + return 1; + case self::MALE_GENDER: + return 0; + case self::BOTH_GENDER: + return 2; + default: + return -1; } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php index 2b82780c2..380112a12 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php @@ -79,7 +79,6 @@ class PersonNormalizer implements 'mobilenumber' => $person->getMobilenumber(), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'gender' => $person->getGender(), - 'gender_numeric' => $person->getGenderNumeric(), 'current_household_address' => $this->normalizer->normalize($person->getCurrentHouseholdAddress()), 'current_household_id' => $household ? $this->normalizer->normalize($household->getId()) : null, ];