improve docgen, trnslations, admin

This commit is contained in:
2021-12-08 13:58:49 +01:00
parent 027c01fc58
commit 70ab232149
11 changed files with 82 additions and 17 deletions

View File

@@ -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 = [])