title: Symfony 2 - fetch the last inserted row from table
body: <p>How can I rewrite this code in order to get last inserted record from the table? </p>
  
  <pre><code>$repository = $entityManager-&gt;getRepository('AdminBundle:MyTable');
  $product = $repository-&gt;find($id);
  </code></pre>
  
  <p>I  tried something like</p>
  
  <pre><code>$repository-&gt;findBy(array('id','DESC')-&gt;setMaxResults(1);
  </code></pre>
  
  <p>But it did not work for me. </p>