hi since doctrine does everything in a transaction, there is no such thing
as last inserted id.

you should simply provide a getId() getter in your domain object.

and use:

$entity = new Something;
$entity->setWhatever('whatever');

$em->persist($entity);
$em->flush();
// after flush all persisted entities will have Id now.
$id = $entity->getId();
// or
$em->getUnitOfWork()->getEntityIdentifier($entity);

On Fri, Apr 29, 2011 at 4:58 PM, sergio <sergio.pe...@albatronic.com> wrote:

> Hi, could anyone tell me how can I get the last insert id with doctrine2?
>
> Thanks in advance
> Enviado desde mi dispositivo BlackBerry®
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to