fix error when context is a string in personJsonNormalizer

This commit is contained in:
Julien Fastré 2022-03-03 14:39:20 +01:00
parent b1c0e18e51
commit f0e41f839f

View File

@ -189,6 +189,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
public function normalize($person, $format = null, array $context = []) public function normalize($person, $format = null, array $context = [])
{ {
$groups = $context[AbstractNormalizer::GROUPS] ?? []; $groups = $context[AbstractNormalizer::GROUPS] ?? [];
if (is_string($groups)) {
$groups = [$groups];
}
$household = $person->getCurrentHousehold(); $household = $person->getCurrentHousehold();
$currentResidentialAddresses = $this->residentialAddressRepository->findCurrentResidentialAddressByPerson($person); $currentResidentialAddresses = $this->residentialAddressRepository->findCurrentResidentialAddressByPerson($person);