Symfony 2.4 - Repeated form field - When values do not match, how to map violation to the second field?

Viewed 835

I have a repeated form field (Symfony 2.4) and I'd like to map only the "values not matching" error to the second field (because it feels more natural in my opinion).

I tried adding this option to the form field:

'error_mapping' => array('.' => 'second_field_name')

But then all the violations (even the ones related to constraints applied to the first field) get mapped to the second field. I tried to dig into the source code but I couldn't find a property path other than . to catch the "values not matching" error.

Has anyone attempted something similar?

2 Answers
Related