From 57b8dacba0ce5a3bf34084bab5aae52eed170f47 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 8 Jan 2025 16:18:13 +0100 Subject: [PATCH 1/2] 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', From b37d7fb907d5c2887a950292a9b78607e59ce681 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 8 Jan 2025 16:21:36 +0100 Subject: [PATCH 2/2] Add changie --- .changes/unreleased/Feature-20250108-161841.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Feature-20250108-161841.yaml diff --git a/.changes/unreleased/Feature-20250108-161841.yaml b/.changes/unreleased/Feature-20250108-161841.yaml new file mode 100644 index 000000000..9074782dc --- /dev/null +++ b/.changes/unreleased/Feature-20250108-161841.yaml @@ -0,0 +1,5 @@ +kind: Feature +body: Improve the UX of the news item admin form to prevent wrong usage +time: 2025-01-08T16:18:41.769719298+01:00 +custom: + Issue: ""