I want to know how can I validate array of arrays in symfony. My validation rules are:
- User - NotBlank
- Date - Date and NotBlank
- Present - NotBlank
So far I have done this:
$validator = Validation::createValidator();
$constraint = new Assert\Collection(array(
'user' => new Assert\NotBlank(),
'date' => new Assert\Date(),
'present' => new Assert\NotBlank()
));
$violations = $validator->validate($request->request->get('absences')[0], $constraint);
But the problem is that it only allows to validate single array eg.
$request->request->get('absences')[0]
.
Here is how the array looks like: