From 2e4e005a552c34f8fd38c1eff1c349136a5c22e8 Mon Sep 17 00:00:00 2001 From: thisfro Date: Tue, 15 Jun 2021 17:55:34 +0200 Subject: [PATCH] Add NotBlank validator component --- src/Form/OfferingFormType.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Form/OfferingFormType.php b/src/Form/OfferingFormType.php index 1cfae36..20d215f 100644 --- a/src/Form/OfferingFormType.php +++ b/src/Form/OfferingFormType.php @@ -10,6 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Image; +use Symfony\Component\Validator\Constraints\NotBlank; class OfferingFormType extends AbstractType { @@ -22,6 +23,11 @@ class OfferingFormType extends AbstractType ]) ->add('description', null, [ 'required' => false, + 'constraints' => [ + new NotBlank([ + 'message' => 'Please enter a short description', + ]), + ] ]) ->add('photo', FileType::class, [ 'required' => false,