In Doctrine2 using some thing like:
$user = array(\'username\' => \'example\', \'passsword\' => \'changeme\'); $conn->insert(\'users\', $user);
If you are using the ORM
$em->persist($object); $em->flush(); $object->getId();
if you are using the DBAL:
$conn->lastInsertId();
http://www.doctrine-project.org/api/dbal/2.5/class-Doctrine.DBAL.Connection.html#_lastInsertId