$user=new user();
$user->setUname('ethan');
$user->setPassword('111');
$user->save();
*$id = $user->getId();*


2011/4/20 Ethan <ruanx...@gmail.com>

> hello, everybody, I'm a newer in symfony. Now I have a question. when I set
> attributes and use save() to store data in database, then I need to get the
> PK of this new row. How can I get it?
>
> e.g.
> $user=new user;
> $user->setUname('ethan');
> $user->setPassword('111');
> $user->save();
>
> then I need to getId of the $user.
>
> I hope the method isn't something like use
> $user=userPeer::retrieveByUname('ethan'); $user->getId();
>
>
>
>
>
> ------------------------------------------
>          少许诺多兑现
> ------------------------------------------
>
>
>  --
> 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
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
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