I have a working Form, it has a required field that needs to be notBlank:
/**
* @Assert\NotBlank
*/
private $field1 = '';
If I specify this field in the request, but leave the field empty, I get this response:
{
"code":400,
"message":"Validation Failed",
"errors":{
"children":{
"field1":{
"errors":["Field should not be blank"]
}
}
}
}
If I omit this field from the request, I get this response:
{
"code":400,
"message":"Validation Failed",
"errors":{
"errors":["Field should not be blank"]
}
}
Is there some built-in Symfony logic somewhere that I can use to make the second example match the first example?
[edit] Was using Symfony 2.5 - now updated to Symfony 2.8.3, same problem.
NotNull
insteadNotBlank
? – walkingRed$buider->add('field1', YourFormType::class, array('error_bubbling' => true))
? – Heah