I'm using Sylius 1.4.4 with Symfony 4.2.8.
And this is a gist of the code I'll be rambling about: https://gist.github.com/migmolrod/1dbad05afc58974f7b938ab67a36b132
if I put an invalid value for any of those properties/fields (phone, mobile, email and/or fax), the error message is shown on top of the form, not attached to the corresponding field.
I've been looking for a solution here in SO but all I found is meant to be used with child entities. In my case, the Contact info is not an entity itself but an array of properties in the form, so to speak.
So can I use the 'error_mapping' to tell the validator "hey, this error belongs to this field" in this particular use case? If so, how? I've tried several permutations of 'error_mapping' => ['several permutations here' => 'the same amount or more permutations here']
and in several places (the call to ContactType inside BusinessType, in the ContactType buildForm, in the ContactType fields...), even clearing cache between changes to be sure everything was in place. But no luck.
What can I do? Better to abstract Contact to a model (even non-mapped to doctrine as an entity/table) and refactor code around that?
Any help would be appreciated. I'd prefer to learn and understand how to use the error_mapping option, even if just out of curiosity at this point.