I have a method which inserts an entry into the database, and I am
trying to retrieve it's ID immediately so I can return the data back
to the screen with javascript:
$this->ticketaddform = new TicketForm();
if ($r->isMethod('post') && $this->ticketaddform->bindAndSave($r-
>getParameter('ticket')))
{
//method is shortened for clarity
$c = new Criteria();
$c->addDescendingOrderByColumn(TicketPeer::CREATED_AT);
$this->newticket = TicketPeer::doSelectOne($c);
}
After the object is saved and stored via bindAndSave() I run a query
to grab the most recently created Ticket. Sometimes it gets an older
ticket, but sometimes it gets the last one. Is there a getLastInsertId
method, or some other similar technique I can use?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---