I have some easy code for entity User in my project
/**
* @Assert\NotBlank()
* @Assert\Date()
*/
protected $dateOfBirth;
As written on Official Documentation for Date() i can send Date parameters like "YYYY-MM-DD", but i always get errors after submit in controller
$form = $this->createForm('Application\Sonata\UserBundle\Form\UserType', new User(), array(
'csrf_protection' => false,
));
$form->submit($request->request->all());
Response:
"dateOfBirth": {
"errors": [
"This value is not valid."
],
"children": {
"year": {},
"month": {},
"day": {}
}
}