mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
vue_accourse: adding current_household link on associated_persons
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
@@ -61,6 +62,9 @@ class PersonNormalizer implements
|
||||
|
||||
public function normalize($person, string $format = null, array $context = array())
|
||||
{
|
||||
/** @var Household $household */
|
||||
$household = $person->getCurrentHousehold();
|
||||
|
||||
/** @var Person $person */
|
||||
return [
|
||||
'type' => 'person',
|
||||
@@ -76,6 +80,7 @@ class PersonNormalizer implements
|
||||
'gender' => $person->getGender(),
|
||||
'gender_numeric' => $person->getGenderNumeric(),
|
||||
'current_household_address' => $this->normalizer->normalize($person->getCurrentHouseholdAddress()),
|
||||
'current_household_id' => $household ? $this->normalizer->normalize($household->getId()) : null,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -89,7 +94,7 @@ class PersonNormalizer implements
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
|
Reference in New Issue
Block a user