mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 15:25:00 +00:00
improve docgen, trnslations, admin
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonAltName;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
@@ -57,7 +58,7 @@ class PersonDocGenNormalizer implements
|
||||
return $this->normalizeNullValue($format, $context);
|
||||
}
|
||||
|
||||
return [
|
||||
$data = [
|
||||
'firstname' => $person->getFirstName(),
|
||||
'lastname' => $person->getLastName(),
|
||||
'altNames' => implode(
|
||||
@@ -84,6 +85,16 @@ class PersonDocGenNormalizer implements
|
||||
'memo' => $person->getMemo(),
|
||||
'numberOfChildren' => (string) $person->getNumberOfChildren(),
|
||||
];
|
||||
|
||||
if ($context['docgen:person:with-household'] ?? false) {
|
||||
$data['household'] = $this->normalizer->normalize(
|
||||
$person->getCurrentHousehold(),
|
||||
$format,
|
||||
array_merge($context, ['docgen:expects' => Household::class])
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = [])
|
||||
|
Reference in New Issue
Block a user