title: Adding a form error in an EventListener
body: <p>I have a Symfony 2.2 based application with a form that has a field that is only required based on another field in the form. I bound an EventListener to catch when the form is submitted so I can verify if the 'required' field is actually not needed when the form is submitted.</p>
  
  <p>I've noticed that I can't set a <code>FormError</code> inside the <code>PRE_BIND</code> form event. Doing so doesn't show the error, but if I bind to the <code>BIND</code> event listener then the form error is displayed properly but I don't want to wait until the BIND event to check for my errors (I don't want the potential of bad data being bound to my entity).</p>
  
  <p>Can someone tell me why this is so?</p>
  
  <pre class="lang-php prettyprint-override"><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      // snip ...
  
      $builder-&gt;addEventListener(FormEvents::PRE_BIND, function(FormEvent $event) use ($options) {
          $data = $event-&gt;getData();
          $form = $event-&gt;getForm();
          if ($data === null) {
              return;
          }
  
          // yes, this is definitely called; If I remove the if() and just
          // and just add the formError it still doesn't work.
          if ($data['type'] == 'port' and empty($data['protocol'])) {
              $form-&gt;get('protocol')-&gt;addError(new FormError('A valid protocol must be selected.'));
          }
  
      });
  
  }
  </code></pre>