I have the following entity:
class Jobs {
//...
/**
* Tasks of Jobs
* @var $tasks array
*/
protected $tasks;
}
tasksis stored as Array in Json File like this:
[
{
"designation": "Task 1",
"action": "Do action 1",
//...
},
{
"designation": "Task 2",
"action": "Do action 2",
//...
},
//...
]
When user define data from form, I would like to implement an assert for validation.
I'm implemented this one (I use yml):
...\Entity\Jobs:
properties:
tasks:
- Collection:
allowMissingFields: false
missingFieldsMessage: jobs.tasks.missingfields
fields:
designation:
- NotBlank:
message: jobs.tasks.fields.blank
##...
When I try to validate form, I have a validation error for data.tasks[designation] and data.tasks[action].
Validation should be applied on second level of array.
How can I configure the validator for this kind of array?