title: Get the primary key id of the inserted row in symfony
body: <p>I have a symfony function that returns a rest api. I can post data to a new record successfully from an endpoint. This is the symfony controller as shown</p>
  
  <pre><code>$users-&gt;setUsername($request-&gt;request-&gt;get('username'));
  $users-&gt;setPhonenumber($request-&gt;request-&gt;get('phonenumber'));
  $users-&gt;setEmail($request-&gt;request-&gt;get('email'));
  $users-&gt;setPassword($request-&gt;request-&gt;get('password'));
  $users-&gt;setDateregistered(new \DateTime('now'));
  
  $em-&gt;persist($users);
  $em-&gt;flush();
  </code></pre>
  
  <p>Assuming that the above inserts a new record successfully into a new table, my challenge is to get the primary key of that table.</p>