Force a field to not be required

前端 未结 2 2068
再見小時候
再見小時候 2021-01-01 12:15

I am using Symfony2 and FOSUserBundle.

Just as detailed in the documentation, I have overridden and created a \"name\" property in the User entity.

I do all

2条回答
  •  無奈伤痛
    2021-01-01 12:59

    Try to use:

    use Symfony\Component\Validator\Constraints\NotNull;
    
    
    $builder->add('name', 'text', array('label' => 'form.name',
    'constraints' => new NotNull()));
    

提交回复
热议问题