title: Doctrine2: discover last ID of the table?
body: <p>I'm writing a query and i have to discover the ID of the last inserted item in a table with Doctrine.</p>
  
  <p>I had to:</p>
  
  <pre><code>$this-&gt;getDoctrine()-&gt;getConnection()-&gt;prepare("SELECT MAX(id) FROM Commit");
  </code></pre>