Doctrine2 Insert and retrieve new insert ID

后端 未结 4 1678
轮回少年
轮回少年 2020-12-30 18:30

In Doctrine2 using some thing like:

$user = array(\'username\' => \'example\', \'passsword\' => \'changeme\');

$conn->insert(\'users\', $user);
         


        
4条回答
  •  囚心锁ツ
    2020-12-30 19:09

    $conn->lastInsertId();will get you the last inserted ID when only using Doctrine's DBAL (sans ORM).

提交回复
热议问题