symfony/symfony — Issue #2536: Form "required=false" Attribute Clashes with NotBlank Validator in Entity
Author: mgatto
Created: 2011-11-01 18:46:53+00:00
State: open

Setting the **required** form element attribute to **false** should not trigger Entity validators. In this example, a Doctrine2 entity has the NotBlank validator which sets required="true" when guessing (using Symfony 2.0.0) :

```php
addPropertyConstraint('research_area', new Assert\NotBlank(array(
'message' => 'Research Area is required',
)));
}
```

However, the form explicitly says the field is not required:

```php
add('research_area', 'entity', array(
'class' => 'Entities\ResearchArea',
'property' => 'name',
'required' => false,
'multiple' => false,
));
```