title: Symfony. Get the last object loaded
body: <p>I have a situation where i must use an entity for persistence and associations with many other entities in several forms.</p>
  
  <p>For example : </p>
  
  <p>Entities <code>A,B,C</code> and <code>D</code> </p>
  
  <p>Relation between A (supposing I want to use the entity <code>A</code> with <code>id 10</code>) and <code>B</code> is <code>oneToMany</code>.</p>
  
  <p>How to get the <code>entity A</code> with <code>Id 10</code> in the controller of the <code>entity B</code> when creating a new <code>entity</code> <code>B</code>  ( <code>b-&gt;setA(A)</code> )</p>
  
  <p>Knowing that i load the entity A only in one form by search </p>
  
  <p>Or how to use loaded <code>entity A</code> with <code>Id 10</code> and use it in others controllers</p>
  
  <p>Thanks</p>