mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: [docgen] add center when normalizing person
This commit is contained in:
parent
9ae2e51819
commit
9029426d03
@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
|
|||||||
use Chill\BudgetBundle\Service\Summary\SummaryBudgetInterface;
|
use Chill\BudgetBundle\Service\Summary\SummaryBudgetInterface;
|
||||||
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
|
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Civility;
|
use Chill\MainBundle\Entity\Civility;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
@ -87,6 +88,7 @@ class PersonDocGenNormalizer implements
|
|||||||
$dateContext['docgen:expects'] = DateTimeInterface::class;
|
$dateContext['docgen:expects'] = DateTimeInterface::class;
|
||||||
$addressContext = array_merge($context, ['docgen:expects' => Address::class]);
|
$addressContext = array_merge($context, ['docgen:expects' => Address::class]);
|
||||||
$phonenumberContext = array_merge($context, ['docgen:expects' => PhoneNumber::class]);
|
$phonenumberContext = array_merge($context, ['docgen:expects' => PhoneNumber::class]);
|
||||||
|
$centerContext = array_merge($context, ['docgen:expects' => Center::class]);
|
||||||
$personResourceContext = array_merge($context, [
|
$personResourceContext = array_merge($context, [
|
||||||
'docgen:expects' => Person\PersonResource::class,
|
'docgen:expects' => Person\PersonResource::class,
|
||||||
// we simplify the list of attributes for the embedded persons
|
// we simplify the list of attributes for the embedded persons
|
||||||
@ -139,6 +141,7 @@ class PersonDocGenNormalizer implements
|
|||||||
'numberOfChildren' => (string) $person->getNumberOfChildren(),
|
'numberOfChildren' => (string) $person->getNumberOfChildren(),
|
||||||
'address' => $this->normalizer->normalize($person->getCurrentPersonAddress(), $format, $addressContext),
|
'address' => $this->normalizer->normalize($person->getCurrentPersonAddress(), $format, $addressContext),
|
||||||
'resources' => $this->normalizer->normalize($person->getResources(), $format, $personResourceContext),
|
'resources' => $this->normalizer->normalize($person->getResources(), $format, $personResourceContext),
|
||||||
|
'center' => $this->normalizer->normalize($person->getCenter(), $format, $centerContext),
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($context['docgen:person:with-household'] ?? false) {
|
if ($context['docgen:person:with-household'] ?? false) {
|
||||||
@ -240,6 +243,7 @@ class PersonDocGenNormalizer implements
|
|||||||
|
|
||||||
$attributes = [
|
$attributes = [
|
||||||
'id', 'firstName', 'lastName', 'age', 'altNames', 'text',
|
'id', 'firstName', 'lastName', 'age', 'altNames', 'text',
|
||||||
|
'center' => Center::class,
|
||||||
'civility' => Civility::class,
|
'civility' => Civility::class,
|
||||||
'birthdate' => DateTimeInterface::class,
|
'birthdate' => DateTimeInterface::class,
|
||||||
'deathdate' => DateTimeInterface::class,
|
'deathdate' => DateTimeInterface::class,
|
||||||
|
@ -40,6 +40,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
|
|||||||
|
|
||||||
private const BLANK = [
|
private const BLANK = [
|
||||||
'id' => '',
|
'id' => '',
|
||||||
|
'center' => '',
|
||||||
'firstName' => '',
|
'firstName' => '',
|
||||||
'lastName' => '',
|
'lastName' => '',
|
||||||
'altNames' => '',
|
'altNames' => '',
|
||||||
@ -64,6 +65,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
|
|||||||
'numberOfChildren' => '',
|
'numberOfChildren' => '',
|
||||||
'age' => '@ignored',
|
'age' => '@ignored',
|
||||||
'resources' => [],
|
'resources' => [],
|
||||||
|
'center' => '@ignored',
|
||||||
];
|
];
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
private NormalizerInterface $normalizer;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8694ad7c4de306f9d5e35af966d24fb2e3e1c2ff
|
Subproject commit 5e478fdfbf429baf3ce852ae69eb1f7101b1b416
|
Loading…
x
Reference in New Issue
Block a user