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; }