mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Fix bug posting birth- and deathdate
This commit is contained in:
@@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
@@ -114,18 +115,14 @@ class PersonJsonNormalizer implements
|
||||
case 'birthdate':
|
||||
$object = $this->denormalizer->denormalize($data[$item], DateTime::class, $format, $context);
|
||||
|
||||
if ($object instanceof DateTime) {
|
||||
$person->setBirthdate($object);
|
||||
}
|
||||
$person->setBirthdate($object);
|
||||
|
||||
break;
|
||||
|
||||
case 'deathdate':
|
||||
$object = $this->denormalizer->denormalize($data[$item], DateTime::class, $format, $context);
|
||||
$object = $this->denormalizer->denormalize($data[$item], DateTimeImmutable::class, $format, $context);
|
||||
|
||||
if ($object instanceof DateTime) {
|
||||
$person->setDeathdate($object);
|
||||
}
|
||||
$person->setDeathdate($object);
|
||||
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user