add validation on start- and enddate of news item

This commit is contained in:
Julie Lenaerts 2023-11-20 15:52:30 +01:00
parent caa2bc1f3c
commit e8b8f30e3c

View File

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