I handle a multi-tab form that is validated by one group per form-tab. When I get errors while binding request, I'd like to know the first tab (ie validation group) that is not valid.
Is it possible with Symfony 2.0, and how ?
Unfortunately this is currently not possible without hacking the core. The problem is that Form
contains a references to FormError
objects, which do not keep references to the original ConstraintViolation
objects, which also do not keep references of the group under which the violation occurred.
I recommend to open a feature request ticket on the issue tracker.
Even if we added this feature, the problem would remain that a constraint is only evaluated once if it belongs to multiple groups that are validated at once. The violation would then only store the first group, even though it would have failed in the other groups too.