mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: deserialise altnames (WIP)
This commit is contained in:
parent
780b7db8cb
commit
c5acfc9bbc
@ -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}");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user