From ebb856fe859c53c93bc6e3f58a44c443466cf078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 7 Jun 2024 13:06:46 +0200 Subject: [PATCH] fix rendering of accompanying course commen with at_date --- .../ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php | 5 +++++ .../AccompanyingCourse/Comment/macro_showItem.html.twig | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php index c972f453a..509dcabb0 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php @@ -167,6 +167,11 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface return $this; } + public function getCreatedBy(): ?User + { + return $this->getCreator(); + } + public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/macro_showItem.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/macro_showItem.html.twig index 8812dcdae..156353652 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/macro_showItem.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/macro_showItem.html.twig @@ -7,10 +7,8 @@ {% endif %} - {% set creator = comment.creator is defined ? comment.creator : comment.createdBy %} - {{ 'by'|trans }}{{ creator }} - - {{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}
+ {{ 'by'|trans }} + {{ comment.createdBy|chill_entity_render_box({'at_date': comment.createdAt }) }}{{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}
{{ 'Last updated on'|trans ~ ' ' ~ comment.updatedAt|format_datetime('long', 'short') }}