From e8b8f30e3c6e78c2cfa750920530d8d87353f0cc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 20 Nov 2023 15:52:30 +0100 Subject: [PATCH] add validation on start- and enddate of news item --- src/Bundle/ChillMainBundle/Entity/NewsItem.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Entity/NewsItem.php b/src/Bundle/ChillMainBundle/Entity/NewsItem.php index 6ca58afd1..7989d5545 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -66,6 +66,8 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="date_immutable", nullable=false) * + * @Assert\NotNull + * * @Groups({"read"}) */ private ?\DateTimeImmutable $startDate = null; @@ -73,6 +75,8 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) * + * @Assert\GreaterThanOrEqual(propertyPath="startDate") + * * @Groups({"read"}) */ private ?\DateTimeImmutable $endDate = null;