Add NotBlank validator component
This commit is contained in:
parent
37ccc83523
commit
2e4e005a55
1 changed files with 6 additions and 0 deletions
|
@ -10,6 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\Image;
|
use Symfony\Component\Validator\Constraints\Image;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
class OfferingFormType extends AbstractType
|
class OfferingFormType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -22,6 +23,11 @@ class OfferingFormType extends AbstractType
|
||||||
])
|
])
|
||||||
->add('description', null, [
|
->add('description', null, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
'constraints' => [
|
||||||
|
new NotBlank([
|
||||||
|
'message' => 'Please enter a short description',
|
||||||
|
]),
|
||||||
|
]
|
||||||
])
|
])
|
||||||
->add('photo', FileType::class, [
|
->add('photo', FileType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
|
Reference in a new issue