Dbal insert returning id

44 views Asked by At

I'm making an insert and I would like to have a return with the insert id. How do I get this return?

Example of how I'm doing the insert.

$query= Database::connection();
$query->insert('test')
->setValue('title', '?')
->setParameter(0, $values['title']);
return $query->executeQuery();

I'm using doctrine dbal querybuilder 3.6.6

I need the insert id to be returned to use this id in another insert.

0

There are 0 answers