From 3aa12d2e8c12672dc4fa42a9fba24d967d4c3dbb Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 15 Feb 2022 17:48:54 +0100 Subject: [PATCH 01/13] [person] Add a PersonRenderInterface --- .../Templating/Entity/PersonRender.php | 3 +- .../Entity/PersonRenderInterface.php | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index c01476b2e..1fcf71486 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Symfony\Component\Templating\EngineInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -22,7 +23,7 @@ use function array_key_exists; /** * Render a Person. */ -class PersonRender extends AbstractChillEntityRender +class PersonRender extends AbstractChillEntityRender implements PersonRenderInterface { private ConfigPersonAltNamesHelper $configAltNamesHelper; diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php new file mode 100644 index 000000000..748bf05b7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -0,0 +1,33 @@ + Date: Wed, 16 Feb 2022 10:27:34 +0100 Subject: [PATCH 02/13] PersonRenderInterface: remove methods --- .../Templating/Entity/PersonRenderInterface.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php index 748bf05b7..b4514a8c2 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -19,15 +19,4 @@ use Chill\PersonBundle\Entity\Person; */ interface PersonRenderInterface extends ChillEntityRenderInterface { - /** - * @param Person $person - */ - public function renderBox($person, array $options): string; - - /** - * @param Person $person - */ - public function renderString($person, array $options): string; - - public function supports($entity, array $options): bool; } From 50410d190fe75c9e87331750fd357438fb664399 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 10:38:58 +0100 Subject: [PATCH 03/13] replace PersonRender by PersonRenderInterface --- .../Service/DocGenerator/ActivityContext.php | 6 +++--- src/Bundle/ChillPersonBundle/Form/PersonResourceType.php | 6 +++--- .../ChillPersonBundle/Search/SimilarPersonMatcher.php | 6 +++--- .../Serializer/Normalizer/PersonDocGenNormalizer.php | 6 +++--- .../Service/DocGenerator/AccompanyingPeriodContext.php | 6 +++--- .../AccompanyingPeriod/LocationValidityValidator.php | 6 +++--- .../AccompanyingPeriod/ParticipationOverlapValidator.php | 6 +++--- .../AccompanyingPeriod/ResourceDuplicateCheckValidator.php | 6 +++--- .../Household/HouseholdMembershipSequentialValidator.php | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 7ee09690a..a787e9ecd 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -22,7 +22,7 @@ use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -43,7 +43,7 @@ class ActivityContext implements private NormalizerInterface $normalizer; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private TranslatableStringHelperInterface $translatableStringHelper; @@ -54,7 +54,7 @@ class ActivityContext implements NormalizerInterface $normalizer, TranslatableStringHelperInterface $translatableStringHelper, EntityManagerInterface $em, - PersonRender $personRender, + PersonRenderInterface $personRender, TranslatorInterface $translator, BaseContextData $baseContextData ) { diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index f69081584..31af0a649 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -16,7 +16,7 @@ use Chill\MainBundle\Form\Type\CommentType; use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; @@ -29,7 +29,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - private PersonRender $personRender; + private PersonRenderInterface $personRender; private ResourceKindRender $resourceKindRender; @@ -37,7 +37,7 @@ final class PersonResourceType extends AbstractType private TranslatorInterface $translator; - public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator) + public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator) { $this->resourceKindRender = $resourceKindRender; $this->personRender = $personRender; diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 98dc14110..c046c8947 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Repository\PersonNotDuplicateRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -39,7 +39,7 @@ class SimilarPersonMatcher protected PersonNotDuplicateRepository $personNotDuplicateRepository; - protected PersonRender $personRender; + protected PersonRenderInterface $personRender; /** * @var TokenStorageInterface @@ -51,7 +51,7 @@ class SimilarPersonMatcher AuthorizationHelper $authorizationHelper, TokenStorageInterface $tokenStorage, PersonNotDuplicateRepository $personNotDuplicateRepository, - PersonRender $personRender + PersonRenderInterface $personRender ) { $this->em = $em; $this->authorizationHelper = $authorizationHelper; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 4dd32aa54..c19b35b57 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -19,7 +19,7 @@ use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonAltName; use Chill\PersonBundle\Repository\Relationships\RelationshipRepository; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use DateTimeInterface; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Serializer\Exception\UnexpectedValueException; @@ -37,7 +37,7 @@ class PersonDocGenNormalizer implements { use NormalizerAwareTrait; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private RelationshipRepository $relationshipRepository; @@ -46,7 +46,7 @@ class PersonDocGenNormalizer implements private TranslatorInterface $translator; public function __construct( - PersonRender $personRender, + PersonRenderInterface $personRender, RelationshipRepository $relationshipRepository, TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index d666c6928..45057038f 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -23,7 +23,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; @@ -48,7 +48,7 @@ class AccompanyingPeriodContext implements private NormalizerInterface $normalizer; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private TranslatableStringHelperInterface $translatableStringHelper; @@ -59,7 +59,7 @@ class AccompanyingPeriodContext implements NormalizerInterface $normalizer, TranslatableStringHelperInterface $translatableStringHelper, EntityManagerInterface $em, - PersonRender $personRender, + PersonRenderInterface $personRender, TranslatorInterface $translator, BaseContextData $baseContextData ) { diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php index b17e1673a..777fc8bf9 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -20,9 +20,9 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class LocationValidityValidator extends ConstraintValidator { - private PersonRender $render; + private PersonRenderInterface $render; - public function __construct(PersonRender $render) + public function __construct(PersonRenderInterface $render) { $this->render = $render; } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index 73c29b1b3..f9f88debe 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod; use Chill\MainBundle\Util\DateRangeCovering; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\Common\Collections\Collection; use Symfony\Component\Validator\Constraint; @@ -26,11 +26,11 @@ class ParticipationOverlapValidator extends ConstraintValidator { private const MAX_PARTICIPATION = 1; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private ThirdPartyRender $thirdpartyRender; - public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) { $this->personRender = $personRender; $this->thirdpartyRender = $thirdPartyRender; diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index 3b84137fb..daf4d67f7 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\Common\Collections\Collection; use Symfony\Component\Form\Exception\UnexpectedTypeException; @@ -24,11 +24,11 @@ use function in_array; class ResourceDuplicateCheckValidator extends ConstraintValidator { - private PersonRender $personRender; + private PersonRenderInterface $personRender; private ThirdPartyRender $thirdpartyRender; - public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) { $this->personRender = $personRender; $this->thirdpartyRender = $thirdPartyRender; diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index c357cb138..eba6fd87e 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Household; use Chill\MainBundle\Util\DateRangeCovering; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -26,9 +26,9 @@ use function count; */ class HouseholdMembershipSequentialValidator extends ConstraintValidator { - private PersonRender $render; + private PersonRenderInterface $render; - public function __construct(PersonRender $render) + public function __construct(PersonRenderInterface $render) { $this->render = $render; } From 81b7b491701bbdc6382bab2e7184f9a25f989ef3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 15:23:32 +0100 Subject: [PATCH 04/13] ChillEntityRenderExtension: change the way the service in constructed by using tags --- .../ChillMainBundle/ChillMainBundle.php | 1 - .../Entity/ChillEntityRenderExtension.php | 11 ++----- .../Templating/Entity/CompilerPass.php | 31 ------------------- .../config/services/templating.yaml | 2 ++ .../ChillPersonBundle/ChillPersonBundle.php | 3 ++ 5 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index 07daf65ea..c18e17918 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -70,7 +70,6 @@ class ChillMainBundle extends Bundle $container->addCompilerPass(new MenuCompilerPass()); $container->addCompilerPass(new ACLFlagsCompilerPass()); $container->addCompilerPass(new GroupingCenterCompilerPass()); - $container->addCompilerPass(new RenderEntityCompilerPass()); $container->addCompilerPass(new CRUDControllerCompilerPass()); } } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php index e1eae3884..c7de92208 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php @@ -25,21 +25,17 @@ class ChillEntityRenderExtension extends AbstractExtension protected $defaultRender; /** - * @var ChillEntityRenderInterface + * @var iterable|ChillEntityRenderInterface[] */ protected $renders = []; /** * ChillEntityRenderExtension constructor. */ - public function __construct() + public function __construct(iterable $renders) { $this->defaultRender = new ChillEntityRender(); - } - - public function addRender(ChillEntityRenderInterface $render) - { - $this->renders[] = $render; + $this->renders = $renders; } /** @@ -78,7 +74,6 @@ class ChillEntityRenderExtension extends AbstractExtension if (null === $entity) { return ''; } - return $this->getRender($entity, $options) ->renderString($entity, $options); } diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php b/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php deleted file mode 100644 index 38f6284ca..000000000 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php +++ /dev/null @@ -1,31 +0,0 @@ -getDefinition(ChillEntityRenderExtension::class); - - foreach ($container->findTaggedServiceIds('chill.render_entity') as $id => $tags) { - $extension->addMethodCall('addRender', [new Reference($id)]); - } - } -} diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index ade26b946..e69700732 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -32,6 +32,8 @@ services: - { name: twig.extension } Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension: + arguments: + $renders: !tagged_iterator chill.render_entity tags: - { name: twig.extension } diff --git a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php index 4e73d2137..5ab96effe 100644 --- a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php +++ b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php @@ -25,6 +25,9 @@ class ChillPersonBundle extends Bundle $container->getExtension('chill_main') ->addWidgetFactory(new PersonListWidgetFactory()); + $container->registerForAutoconfiguration(PersonRenderInterface::class) + ->addTag('chill.render_entity'); + $container->addCompilerPass(new AccompanyingPeriodTimelineCompilerPass()); } } From 02716a6a93f1865d03505cd527039a6e8cea8594 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 15:55:26 +0100 Subject: [PATCH 05/13] PersonRender: adapt twig template to suffixText --- .../Resources/views/Entity/person.html.twig | 6 ++++++ .../ChillPersonBundle/Templating/Entity/PersonRender.php | 1 + .../Templating/Entity/PersonRenderInterface.php | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 9bee504a9..d415426cd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -12,6 +12,7 @@ * hLevel integer * addDeath bool * addAgeBadge bool + * suffixText bool * address_multiline bool * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -46,6 +47,11 @@ ({{- 'years_old'|trans({ 'age': person.age }) -}}) {% endif %} {% endif %} + {%- if options['suffixText'] is defined -%} + {% for o in options['suffixText'] %} + {{ o }} + {% endfor %} + {% endif %} {% endmacro raw %} {% macro label(person, options) %} diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 1fcf71486..2815aa41f 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -60,6 +60,7 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte 'customArea' => $options['customArea'] ?? [], 'addDeath' => $options['addDeath'] ?? true, 'addAgeBadge' => $options['addAgeBadge'] ?? false, + 'suffixText' => $options['suffixText'] ?? [], ]; return diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php index b4514a8c2..631402851 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -12,7 +12,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; -use Chill\PersonBundle\Entity\Person; /** * Render a Person. From 56a4fd3fa001932c60edce7128d5a551d4f1ddbb Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 16:20:08 +0100 Subject: [PATCH 06/13] Person: add suffixText in PersonText.vue --- .../Resources/public/vuejs/_components/Entity/PersonText.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index 8f89649d8..02f8de49b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -6,6 +6,7 @@ ({{ altNameLabel }}) + {{ person.suffixText }} {{ $tc('renderbox.years_old', person.age) }}  (‡) From b992bde41d89d80bb0fdda1376f3d451f3cc313a Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 21:09:27 +0100 Subject: [PATCH 07/13] Created an interface for PersonJsonNormalizer --- .../Normalizer/PersonJsonNormalizer.php | 6 +--- .../PersonJsonNormalizerInterface.php | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index e91748de8..f24bf8f62 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -33,11 +33,7 @@ use function array_key_exists; /** * Serialize a Person entity. */ -class PersonJsonNormalizer implements - DenormalizerAwareInterface, - DenormalizerInterface, - NormalizerAwareInterface, - NormalizerInterface +class PersonJsonNormalizer implements PersonJsonNormalizerInterface { use DenormalizerAwareTrait; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php new file mode 100644 index 000000000..0942b8c61 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php @@ -0,0 +1,36 @@ + Date: Tue, 22 Feb 2022 10:48:14 +0100 Subject: [PATCH 08/13] personRenderBox: correct addition of suffixText --- .../public/vuejs/_components/Entity/PersonRenderBox.vue | 2 ++ .../Resources/public/vuejs/_components/Entity/PersonText.vue | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index dd26db217..e9a0c6c05 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -12,6 +12,7 @@ {{ person.firstName }} {{ person.lastName }} +  {{ person.suffixText }} {{ altNameLabel }} @@ -20,6 +21,7 @@ {{ person.firstName }} {{ person.lastName }} +  {{ person.suffixText }} (‡) {{ altNameLabel }} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index 02f8de49b..8b991e3da 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -6,7 +6,7 @@ ({{ altNameLabel }}) - {{ person.suffixText }} +  {{ person.suffixText }} {{ $tc('renderbox.years_old', person.age) }}  (‡) From 665027085d9cd7db707efeb362a8aea367767e85 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Feb 2022 11:05:18 +0100 Subject: [PATCH 09/13] move DenormalizerAwareInterface and NormalizerAwareInterface from the interface to the class --- .../Serializer/Normalizer/PersonJsonNormalizer.php | 4 +--- .../Serializer/Normalizer/PersonJsonNormalizerInterface.php | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index f24bf8f62..7a60c32b4 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -23,17 +23,15 @@ use Doctrine\Common\Collections\Collection; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; -use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; -use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait; use function array_key_exists; /** * Serialize a Person entity. */ -class PersonJsonNormalizer implements PersonJsonNormalizerInterface +class PersonJsonNormalizer implements PersonJsonNormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php index 0942b8c61..10ffa04d1 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php @@ -11,18 +11,14 @@ declare(strict_types=1); namespace Chill\PersonBundle\Serializer\Normalizer; -use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; -use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** * Serialize a Person entity. */ interface PersonJsonNormalizerInterface extends - DenormalizerAwareInterface, DenormalizerInterface, - NormalizerAwareInterface, NormalizerInterface { public function denormalize($data, $type, $format = null, array $context = []); From 2f7b237c4c407f4d6afa03f1c8f5d90d553ca35f Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Feb 2022 11:08:38 +0100 Subject: [PATCH 10/13] PersonJsonNormalizer interface: remove functions --- .../Normalizer/PersonJsonNormalizerInterface.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php index 10ffa04d1..fd41752a8 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php @@ -21,12 +21,4 @@ interface PersonJsonNormalizerInterface extends DenormalizerInterface, NormalizerInterface { - public function denormalize($data, $type, $format = null, array $context = []); - - public function normalize($person, $format = null, array $context = []); - - public function supportsDenormalization($data, $type, $format = null); - - public function supportsNormalization($data, $format = null): bool; - } From 08c1bb799224b52f87861034b0e8b6cd4c726fba Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Feb 2022 11:11:41 +0100 Subject: [PATCH 11/13] remove useless registerForAuyoconfiguration --- src/Bundle/ChillPersonBundle/ChillPersonBundle.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php index 5ab96effe..4e73d2137 100644 --- a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php +++ b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php @@ -25,9 +25,6 @@ class ChillPersonBundle extends Bundle $container->getExtension('chill_main') ->addWidgetFactory(new PersonListWidgetFactory()); - $container->registerForAutoconfiguration(PersonRenderInterface::class) - ->addTag('chill.render_entity'); - $container->addCompilerPass(new AccompanyingPeriodTimelineCompilerPass()); } } From fbeda163f01fe88e354da334be6aaa7ef5449825 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Feb 2022 12:07:56 +0100 Subject: [PATCH 12/13] update CHANGELOG --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c392663a..53f7833d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to ## Unreleased - +* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441) ## Test releases ### test release 2022-02-14 @@ -22,7 +22,7 @@ and this project adheres to * [person] accompanying course work: fix on-the-fly update of thirdParty * fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378) * [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427) -* [person] accompanying course work: fix on-the-fly update of thirdParty +* [person] accompanying course work: fix on-the-fly update of thirdParty * [on-the-fly] close modal only after validation * [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433) * change order for accompanying course work list From 71f3a3403c75b1bc9cd686f01981b66294f0677a Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Feb 2022 12:12:53 +0100 Subject: [PATCH 13/13] php code fix for Enfant Confie --- src/Bundle/ChillMainBundle/ChillMainBundle.php | 1 - .../Templating/Entity/ChillEntityRenderExtension.php | 1 + .../Serializer/Normalizer/PersonJsonNormalizer.php | 4 +--- .../ChillPersonBundle/Templating/Entity/PersonRender.php | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index c18e17918..32e075b7f 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -29,7 +29,6 @@ use Chill\MainBundle\Security\ProvideRoleInterface; use Chill\MainBundle\Security\Resolver\CenterResolverInterface; use Chill\MainBundle\Security\Resolver\ScopeResolverInterface; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; -use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php index c7de92208..2081f3d9a 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php @@ -74,6 +74,7 @@ class ChillEntityRenderExtension extends AbstractExtension if (null === $entity) { return ''; } + return $this->getRender($entity, $options) ->renderString($entity, $options); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 7a60c32b4..e51c730fd 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -31,12 +31,10 @@ use function array_key_exists; /** * Serialize a Person entity. */ -class PersonJsonNormalizer implements PersonJsonNormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwareInterface, PersonJsonNormalizerInterface { use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ObjectToPopulateTrait; private CenterResolverManagerInterface $centerResolverManager; diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 2815aa41f..11236955c 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Symfony\Component\Templating\EngineInterface; use Symfony\Contracts\Translation\TranslatorInterface;