docgen: add age and base context

This commit is contained in:
2021-12-15 23:42:37 +01:00
parent 689f612382
commit 9453fc2dd5
6 changed files with 15 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ class PersonDocGenNormalizer implements
$data = [
'type' => 'person',
'isNull' => false,
'civility' => $this->normalizer->normalize($person->getCivility(), $format, array_merge($context, ['docgen:expect' => Civility::class])),
'civility' => $this->normalizer->normalize($person->getCivility(), $format, array_merge($context, ['docgen:expects' => Civility::class])),
'firstname' => $person->getFirstName(),
'lastname' => $person->getLastName(),
'altNames' => implode(
@@ -87,6 +87,7 @@ class PersonDocGenNormalizer implements
)
),
'text' => $this->personRender->renderString($person, []),
'age' => $person->getAge(),
'birthdate' => $this->normalizer->normalize($person->getBirthdate(), $format, $dateContext),
'deathdate' => $this->normalizer->normalize($person->getDeathdate(), $format, $dateContext),
'gender' => $this->translator->trans($person->getGender()),