normalization of phonenumber

This commit is contained in:
2022-03-02 14:10:48 +01:00
parent 2a9f1dc238
commit f4f488dad1
4 changed files with 68 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ use Chill\PersonBundle\Repository\PersonRepository;
use DateTime;
use DateTimeImmutable;
use Doctrine\Common\Collections\Collection;
use libphonenumber\PhoneNumber;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
@@ -111,12 +112,12 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
break;
case 'phonenumber':
$person->setPhonenumber($this->phoneNumberHelper->denormalize($data[$item]));
$person->setPhonenumber($this->denormalizer->denormalize($data[$item], PhoneNumber::class, $format, $context));
break;
case 'mobilenumber':
$person->setMobilenumber($this->phoneNumberHelper->denormalize($data[$item]));
$person->setMobilenumber($this->denormalizer->denormalize($data[$item], PhoneNumber::class, $format, $context));
break;