<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>no</td>
</tr>
<tr>
<td>Feature request?</td>
<td>yes</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>3.2.1</td>
</tr>
</tbody>
</table>
<p dir="auto">I use a form field using snake_case, while I use camelCase for the property name (and for the getter and setter method for this property) in the model.</p>
<p dir="auto">When the form is submitted, the data is mapped to the model properties:<br>
the PropertyPathMapper uses the PropertyAccessor to set the value. The PropertyAccessor uses a camelize() method to find getters and setters for the property.</p>
<p dir="auto">But when a validation error occurs on such a property, it is not mapped back to the form field, because the ViolationMapper compares the camelCased propertyPath of the model property with the snake_cased propertyPath of the form field.</p>
<p dir="auto">This may not be a bug, and people should not use a form field with another name than the property, (when not explicitly using the property_path option of the form field).<br>
But I find it confusing that the mapping used for changing the model based on the form data works, but mapping the validation errors back to the form field does not.</p>
<p dir="auto">Hi.<br>
Today I searched two hours for the reason why one validation error wasn't shown at the form field but at the root form.<br>
My form builder class looked like that:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder-&gt;add('xfade', 'integer', array('required' =&gt; false));
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">buildForm</span>(<span class="pl-smi"><span class="pl-smi">FormBuilderInterface</span></span> <span class="pl-s1"><span class="pl-c1">$</span>builder</span>, <span class="pl-smi">array</span> <span class="pl-s1"><span class="pl-c1">$</span>options</span>)
{
    <span class="pl-s1"><span class="pl-c1">$</span>builder</span>-&gt;<span class="pl-en">add</span>(<span class="pl-s">'xfade'</span>, <span class="pl-s">'integer'</span>, <span class="pl-en">array</span>(<span class="pl-s">'required'</span> =&gt; <span class="pl-c1">false</span>));
}</pre></div>
<p dir="auto">My <code class="notranslate">validation.yml</code> looked like that:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Streamserver:
    properties:
        xFade:
            - Range: { min: 0, groups: [ Default ] }"><pre class="notranslate"><span class="pl-ent">Streamserver</span>:
    <span class="pl-ent">properties</span>:
        <span class="pl-ent">xFade</span>:
            - <span class="pl-ent">Range</span>: <span class="pl-s">{ min: 0, groups: [ Default ] }</span></pre></div>
<p dir="auto">The validation error of the property <em>xFade</em> wasn't mapped to the form field <em>xfade</em> and that error was hard to find, because the value of the field was mapped correctly to the entity of course.</p>
<p dir="auto">One possible solution would be:</p>
<p dir="auto">When mapping violation to form child (in <code class="notranslate">Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper-&gt;matchChild()</code>) do a case-insensitive comparison.</p>
<p dir="auto">But maybe there are better ways.</p>