Get the last insert id with doctrine 2? January 26, 2023 by Tarik I had to use this after the flush to get the last insert id: $em->persist($user); $em->flush(); $user->getId();