PersonJsonNormalizer: fix circular reference with residential address

This commit is contained in:
nobohan 2022-03-01 14:15:39 +01:00
parent 1e146f542e
commit a7240e8cc6

View File

@ -197,7 +197,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
'age' => $this->normalizer->normalize($person->getAge(), $format, $context),
];
if (in_array("minimal", $groups) && 1 === count($context)) {
if (in_array("minimal", $groups) && 1 === count($groups)) {
return $data;
}
@ -209,7 +209,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
'altNames' => $this->normalizeAltNames($person->getAltNames()),
'gender' => $person->getGender(),
'current_household_id' => $household ? $this->normalizer->normalize($household->getId(), $format, $context) : null,
'current_residential_addresses' => $currentResidentialAddresses ? $this->normalizer->normalize($currentResidentialAddresses, $format, $context) : null,
'current_residential_addresses' => $currentResidentialAddresses ?
$this->normalizer->normalize($currentResidentialAddresses, $format, $context) :
null,
]);
}