title: How validate a selection of at least one element (or N elements) in Symfony 2?
body: <p>My form as field <code>users</code> (entity type). How can i add validation in order to specificity that <strong>at least one user should be selected</strong>? Actually i'm adding an event listener but i don't know if this is a legit solution or not:</p>
  
  <pre><code>public function buildForm(\Symfony\Component\Form\FormBuilder $builder,
      array $options)
  {
      $builder
          -&gt;add('title', 'text', array(
              'label' =&gt; 'Titolo'
          ))
          -&gt;add('content',  'textarea', array(
              'label' =&gt; 'Contenuto'
          ))
          -&gt;add('sender_text',  'text', array(
              'label' =&gt; 'Mittente testuale',
          ))
          -&gt;add('users', 'entity', array(
              'label'    =&gt; 'Destinatari',
              'class'    =&gt; 'DL\FidelityBundle\Entity\User',
              'property' =&gt; 'select_label',
              'multiple' =&gt; true
          ));
      ;
  
      // Valida il numero di utenti selezionati
      $builder-&gt;addEventListener(\Symfony\Component\Form\FormEvents::POST_BIND,
          function($event) {
              $form = $event-&gt;getForm();
              $data = $event-&gt;getData();
  
              if(!$data-&gt;users-&gt;isEmpty()) return;
  
              $msg = 'Occorre specificare almeno un utente destinatario';
              $form-&gt;get('users')-&gt;addError(new FormError($msg));
      });
  }
  </code></pre>