title: Save form data temporary
body: <p>The user has the ability to filter a list of data. For this use case i build a form type "UserFilterType", which look like this.</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder-&gt;add('firstName', 'text', array('attr' =&gt; array('maxlength' =&gt; 255)))
               -&gt;add('roles', 'entity', array(
                  'class' =&gt; 'ApplicationUserBundle:Role',
                  'property' =&gt; 'name',
                  'label' =&gt; false,
                  'multiple' =&gt; false,
                  'expanded' =&gt; false,
                  'empty_value' =&gt; 'msg.role.all',
                  'translation_domain' =&gt; 'role', 'required' =&gt; false)
               ));
  }
  </code></pre>
  
  <p>So far everything works very well. The user can filter the output. But if the user wants to sort the output, eg by first name. A get request executed and filter options lost. I will save the filter options temporary, maybe in a session.</p>
  
  <p>I try the following option:</p>
  
  <pre><code>$session = $this-&gt;getRequest()-&gt;getSession();
  $session-&gt;set('userFilter', serialize($form-&gt;getData());
  .....
  $form-&gt;setData(unserialize($session-&gt;set('userFilter')));
  </code></pre>
  
  <p>The form fields are filled out correctly, but if i execute the filter again with a post request i get the following error message</p>
  
  <p>"Entities passed to the choice field must be managed. Maybe persist them in the entity manager?"</p>
  
  <p>Does anyone have any idea how I should proceed? I hope I could describe my problem understandable.</p>