title: Add error to Symfony2 Form
body: <p>I am trying to add error to form using FormError. Error must be displayed when user tries to create collection with existing name. But this code doesn't work, and I can't understand why</p>
  
  <pre><code>  public function submitInObjectAction(Request $request)
  {
      $collection = new Collection();
      $user = $this-&gt;getUser();
      $form = $this-&gt;createForm(
          new CollectionType(),
          $collection
      );
  
  
      $form-&gt;handleRequest($request);
      if ($form-&gt;isValid() &amp;&amp; $form-&gt;isSubmitted()) {
  
          $colname = $form["name"]-&gt;getData();
          $existing = $this-&gt;getDoctrine()-&gt;getRepository('CollectionBundle:Collection')
                           -&gt;findBy(['name' =&gt; $colname, 'user' =&gt; $user]);
          if ($existing != NULL) {
              $error = new FormError("You already have collection with such name");
              $form-&gt;get('name')-&gt;addError($error);
          }
  
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $collection-&gt;setUser($user);
          $em-&gt;persist($collection);
          $em-&gt;flush();
  
          return new JsonResponse([
              'id' =&gt; $collection-&gt;getId(),
              'name' =&gt; $collection-&gt;getName()
          ]);
      }
  }
  </code></pre>
  
  <p>I cannot use annotation on name field in Collection entity, because names must be unique only for particular user</p>