title: Array of objects as session variable symfony
body: <p>I'm trying set a varible session with an array of objects in a Symfony Controller. I had tried <code>$session-&gt;set('expedients', serialize($expedients));</code> and <code>$session-&gt;set('expedients', $expedients);</code> too; but the next step, when I go to get the variable into a new variable in another controller, what I must do to get the original array of objects? My result by the moment is: `     </p>
  
  <pre><code>object(Doctrine\ORM\PersistentCollection)#923 (9) { 
      ["snapshot":"Doctrine\ORM\PersistentCollection":private]=&gt; array(0) { } 
      ["owner":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL 
      ["association":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL 
      ["em":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL 
      ["backRefFieldName":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL 
      ["typeClass":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL 
      ["isDirty":"Doctrine\ORM\PersistentCollection":private]=&gt; bool(false) 
      ["collection":protected]=&gt; object(Doctrine\Common\Collections\ArrayCollection)#925 (1) { 
      ["elements":"Doctrine\Common\Collections\ArrayCollection":private]=&gt; array(0) { } }
      ["initialized":protected]=&gt; bool(false)
  } 
  </code></pre>