title: I'm losing the association of an error to a form field in Symfony2
body: <p>My validation looks like</p>
  
  <pre><code>Acme\UserBundle\Entity\User:
      constraints:
          - \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: { fields:username, message: "Username already in use" }
          - \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: { fields:email, message: "Email address already in use" }
      properties:
          username:
              - NotBlank: ~
              - MinLength: { limit: 2, message: "Your username must have at least {{ limit }} characters." }
          email:
              - Email:
                  message: The email "{{ value }}" is not a valid email.
                  checkMX: true
  </code></pre>
  
  <p>My controller like:</p>
  
  <pre><code>$form = $this-&gt;createForm(new RegistrationType());
  $form-&gt;bindRequest($request);
  if ($form-&gt;isValid()) {
      //... save to db
  }else{
      $errors = $form-&gt;getErrors();
      //... pass the errors back as json
  }
  </code></pre>
  
  <p>I'm trying to build a user registration controller that is submitted via ajax request. However, when errors in validation are triggered, the <code>$error</code> variable looks like:</p>
  
  <pre><code>[2011-11-07 19:19:44] app.INFO: array (
    0 =&gt; 
    Symfony\Component\Form\FormError::__set_state(array(
       'messageTemplate' =&gt; 'Email address already in use',
       'messageParameters' =&gt; 
      array (
      ),
    )),
    1 =&gt; 
    Symfony\Component\Form\FormError::__set_state(array(
       'messageTemplate' =&gt; 'Your username must have at least {{ limit }} characters.',
       'messageParameters' =&gt; 
      array (
        '{{ value }}' =&gt; '1',
        '{{ limit }}' =&gt; 2,
      ),
    )),
  ) [] []
  </code></pre>
  
  <p>The problem is I have no idea which field that error corresponds to. Is there some way to find that data so that when I send the json response, I can associate the error message with the relevant field.</p>