diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index c0ba0201a..ea385d149 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Entity\PersonAltName; use Chill\PersonBundle\Repository\PersonRepository; use DateTime; use LogicException; @@ -79,7 +80,7 @@ class PersonJsonNormalizer implements } foreach (['firstName', 'lastName', 'phonenumber', 'mobilenumber', 'gender', - 'birthdate', 'deathdate', 'center', ] + 'birthdate', 'deathdate', 'center', 'altNames'] as $item) { if (!array_key_exists($item, $data)) { continue; @@ -135,6 +136,16 @@ class PersonJsonNormalizer implements break; + case 'altNames': + foreach($data[$item] as $altName){ + $object = $this->denormalizer->denormalize($altName, PersonAltName::class, $format, $context); + dump($object); //TODO not working + if ($object instanceof PersonAltName) { + $person->addAltName($object); + } + } + break; + default: throw new LogicException("item not defined: {$item}"); }