From 61c2a0ea42e79a9de731633613cb03b49e59fc23 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 31 Mar 2022 10:27:16 +0200 Subject: [PATCH] allow for phonenumber or mobilenumber to be left empty for person --- CHANGELOG.md | 1 + .../Serializer/Normalizer/PhonenumberNormalizer.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94489398e..85e3771e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ and this project adheres to * [person] Trailing guillemet removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/530) * [notification] Display of social action within workflow notification set to display block (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/537) * [onthefly] trim trailing whitespace in email of person and thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/542) +* [person] fix bug when phonenumber or mobile number is left empty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/546) ## Test releases diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index 7eb323754..15a75f9c9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -40,7 +40,11 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal */ public function denormalize($data, $type, $format = null, array $context = []) { - if ('' === trim($data)) { + if (null === $data) { + return null; + } + + if (null !== $data && '' === trim($data)) { return null; }