I have a simple form using only form types delivered by the form package and want to get all form errors.
->createBuilder('form', $preselects, array('error_bubbling' => false))
->add('wealth', 'integer', array(
'constraints' => array(
new Range(array(
'min' => 1
))
)
))
->add('group', 'choice', array('choices' => $groups))
->getForm();
Regarding the upgrade doc there are new parameters for getErrors($deep = false, $flatten = true)
.
I am confused why I need now to give the first parameter to get the errors of simple types.
If I do this I can retrieve the error of wealth or group, but I don't really understand how to get the name of the child.
I have an instance of FormError and want to get the child name. I can get the propertyPath over the cause but it would look like children[wealth].data. I just want to get wealth.
Do I really need to modify the string itself?
My expected result is to get an array containing the child name as key and the errors as value to that child. The problem is not to get the error message but the child name.
Thanks for any hints.