From 57b8dacba0ce5a3bf34084bab5aae52eed170f47 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 8 Jan 2025 16:18:13 +0100 Subject: [PATCH] Indicate user to set startDate equal to or greater than today + set empty_data in form content field --- src/Bundle/ChillMainBundle/Entity/NewsItem.php | 1 + src/Bundle/ChillMainBundle/Form/NewsItemType.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Entity/NewsItem.php b/src/Bundle/ChillMainBundle/Entity/NewsItem.php index 7acf2de86..78ca5bcf2 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -46,6 +46,7 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface private string $content = ''; #[Assert\NotNull] + #[Assert\GreaterThanOrEqual('today')] #[Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; diff --git a/src/Bundle/ChillMainBundle/Form/NewsItemType.php b/src/Bundle/ChillMainBundle/Form/NewsItemType.php index b6a93a0a0..6fe513055 100644 --- a/src/Bundle/ChillMainBundle/Form/NewsItemType.php +++ b/src/Bundle/ChillMainBundle/Form/NewsItemType.php @@ -29,6 +29,7 @@ class NewsItemType extends AbstractType ]) ->add('content', ChillTextareaType::class, [ 'required' => false, + 'empty_data' => '', ]) ->add( 'startDate',