From 146103e87c0cf8fef61b4b6bff1d72b84f710c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 21 Jun 2023 13:33:29 +0200 Subject: [PATCH] Fixed: Accompanyingperiod / comment: order by newest to oldest --- .changes/unreleased/Fixed-20230621-132851.yaml | 6 ++++++ src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20230621-132851.yaml diff --git a/.changes/unreleased/Fixed-20230621-132851.yaml b/.changes/unreleased/Fixed-20230621-132851.yaml new file mode 100644 index 000000000..89fb7cdd9 --- /dev/null +++ b/.changes/unreleased/Fixed-20230621-132851.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: '[Accompanying period comments]: order comments from the most recent to the + oldest, in the list' +time: 2023-06-21T13:28:51.282714011+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index a8e191df3..accf39db5 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -185,7 +185,9 @@ class AccompanyingPeriod implements * cascade={"persist", "remove"}, * orphanRemoval=true * ) + * @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"}) * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT}) + * @var Collection */ private Collection $comments; @@ -705,10 +707,11 @@ class AccompanyingPeriod implements ->comments ->filter( static fn (Comment $c): bool => $c !== $pinnedComment - ); + ) + ; } - public function getCreatedAt(): ?DateTime + public function getCreatedAt(): DateTimeInterface { return $this->createdAt; }