title: Symfony2.6: Form handle a request with array data instead entity
body: <p>I have a FormType that creates checkboxes groups based on an array that is passed in the creation of that FormType:</p>
  
  <pre><code>//FormType.php
  
  public function __construct(array $choices, array $choicesData)
  {
      $this-&gt;choices = $choices;
      $this-&gt;choicesData = $choicesData;
  }
  
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      foreach ($this-&gt;choices as $bundle =&gt; $class) {
          $choiceBuilder = $builder-&gt;create($bundle, 'form', array('virtual' =&gt; true));
          foreach ($class as $name =&gt; $perm) {
              $choiceBuilder-&gt;add(
                      $name, 'choice', array(
                      'choices' =&gt; $perm,
                      'multiple' =&gt; true,
                      'mapped' =&gt; false,
                      'expanded' =&gt; true,
                      'required' =&gt; 'false',
                      'label' =&gt; $name,
                      'data' =&gt; $this-&gt;choicesData[$bundle][$name]
                  )
              );
          }
          $builder-&gt;add($choiceBuilder);
      }
      $builder-&gt;add('salvar', 'submit', array('label' =&gt; false));
  }
  </code></pre>
  
  <p><strong>Notice:</strong> No setDefaultOptions in Type.</p>
  
  <p>Then I create the form:</p>
  
  <pre><code>//Controller.php
  
   $form = $this-&gt;createForm(new PermissaoType($choices, $choicesData), $choicesData);
  </code></pre>
  
  <p><strong>My Problem:</strong> but when I making the <strong>handleRequest()</strong> of the data sent with POST <strong>getData()</strong> does not return the change of the form, only that which is set at <strong>$choicesData</strong>. Could anyone help me on this?</p>
  
  <pre><code>//Controller.php
  
  if ($request-&gt;isMethod('POST')) {
  
      $form-&gt;handleRequest($request); // Not Work
      $data = $form-&gt;getData(); // Return $choicesData original
  }
  </code></pre>
  
  <p>Example $choiceData original:</p>
  
  <pre><code>array(
      'group1' =&gt; array(
                      'item1' =&gt; array('chk1' =&gt; false, 'chk2' =&gt; false, 'chk3' =&gt; false)
      )
  );
  </code></pre>
  
  <p>Example of form submitted:</p>
  
  <pre><code>array(
  'group1' =&gt; array(
                  'item1' =&gt; array( 0 =&gt; 'chk1', 1 =&gt; 'chk3')
      )
  );
  </code></pre>
  
  <p>Example $choiceData returned (after $form->handleRequest() and $form->getData()):</p>
  
  <pre><code>array(
      'group1' =&gt; array(
                      'item1' =&gt; array('chk1' =&gt; false, 'chk2' =&gt; false, 'chk3' =&gt; false)
      )
  );
  </code></pre>
  
  <p>Thank a lot.</p>