title: symfony2 pull from DB right after flush() not possible?
body: <p>(SEE LAST LINE OF QUESTION FOR SOLUTION)</p>
  
  <p>Is there a time limit for when I can pull a flushed value out from the DB?</p>
  
  <p>Because when I add an entity and flush it into DB like this...</p>
  
  <pre><code>        //Persist the entity and flush it to DB
          $em-&gt;persist($entity);
          $em-&gt;flush();
  
          $helper-&gt;log('success', 'Innehållet &lt;strong&gt;'. $entity-&gt;getTitle() .'&lt;/strong&gt; (id:&lt;strong&gt;'. $entity-&gt;getId() .'&lt;/strong&gt;) har skapats i '.$place.$purified. $videoMessage);
  
          $helper-&gt;generateManifestForAll( $currentCompany-&gt;getId() );
          $helper-&gt;log('success', 'Manifest &amp; slideData updated');
  </code></pre>
  
  <p>And try to read it back inside the $helper->generateManifestForAll() it doesn't exist yet. If I repeat the process by adding another entity, then the first entity is included (but not the second, naturally. Not until I create a third entity...).</p>
  
  <p>If I trigger the generateManifestForAll() manually afterward that also works to have the new entity included, so it seems to be a problem of them sitting inside the same controller or something..?</p>
  
  <p>------------------ UPDATE --------------------------</p>
  
  <p>Could it have something to do with the fact that generateManifestForAll() is inside a service?</p>
  
  <p>First I instantiate the service object $helper (which has an entityManager injected into it), then I use $em->flush() inside my controller. And then finally I run the generateManifestForAll() which pulls data out.</p>
  
  <p>I could paste all the code but it is so much, I thought maybe you could detect an error already in the concept here?</p>
  
  <p>-------------------- Another Update -------------------</p>
  
  <p>These two debug loops give me the exact same output.</p>
  
  <pre><code>//debug
  echo "beforeFlush&lt;br/&gt;";
  $data = $entity-&gt;getContainer()-&gt;getContent();
  foreach($data as $d) {
  echo $d-&gt;getTitle().'&lt;br/&gt;';
  }
  
  //Persist the entity and flush it to DB
          $em-&gt;persist($entity);
          $em-&gt;flush();
          $em-&gt;refresh($entity);
  
  //debug
  echo " ";
  echo "&lt;br/&gt;&lt;br/&gt;afterFlush&lt;br/&gt;";
  $data = $entity-&gt;getContainer()-&gt;getContent();
  foreach($data as $d) {
  echo $d-&gt;getTitle().'&lt;br/&gt;';
  }
  die;
  </code></pre>
  
  <p>AND THE FINAL SOLUTION - IN MY CASE, OBVIOUSLY CALL REFRESH ON </p>
  
  <pre><code>        $em-&gt;refresh($entity-&gt;getContainer());
  </code></pre>
  
  <p>SINCE THAT'S THE ENTITY I'M LOOPING FROM.</p>