add( 'name', TextType::class, [ 'label' => 'Nom', 'required' => false, // html5 validation disable for the example 'constraints' => [ new NotBlank(), ], ] ); } /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => Category::class, 'csrf_protection' => false, 'allow_extra_fields' => true, ]); } /** * {@inheritdoc} */ public function getBlockPrefix() { return ''; } }