I need the Symfony2 Validator to return an array rather than an object.
So something like this:
$insert = new MyEntity();
$insert->setTest1( 'testtesttest' );
$validator = $this->get('validator');
$errors = $validator->validate($insert);
...would enable this:
$errors[0]['message'] = "The email is not valid"
Just a simple array as parsing the object returned is very difficult.
I understand the validator config, but I just need the Validator to return an array not its usual object.
I'm JSON encoding the result and (a) json_encode struggles with objects + (b) I don't want to return the whole object just a list of errors.
I'm not using the in-built forms, just the raw Validator.