So, I separated my functions (register and update), first I'll make my register function, I've tried to rewrite it all I want to create user ONLY (temporarily) in sf_guard_user_profile ( ALWAYS with user_id = 1(I'm trying to understand symfony system)) , so I did something like this
public function executeRegister($request){ $this->forward404Unless($request->isMethod('post')); $this->form = new SfGuardUserProfileForm(); $this->form->bind($request- >getParameter('sf_guard_user_profile')); $this->form->getObject()->setUserId(1); // line 71 if ($this->form->isValid()) { $sf_guard_user_profile = $this->form->save(); $this->redirect('user/edit?id='.$sf_guard_user_profile- >getId()); } $this->setTemplate('edit'); } althought if I echo $this->form->getObject()->getUserId() the result is 1 (instead of 3 from $_POST), result in the database is default (3) instead of 1, I'm really confused can somebody help me? On Aug 26, 9:20 pm, Lee Bolding <[EMAIL PROTECTED]> wrote: > You're using a function named update to create new users??? > > Try using separate functions for creating and updating users, it will > make your life a LOT easier. > > The update function doesn't need to create any new objects, and in the > registration function, you can use the shortcut $profile = $user- > >getsfGuardProfile() to get a users profile OR create a new one if > one doesn't exist for that user. You don't need to create a new > sfGuardUserProfile object. > > HTH > > On 26 Aug 2008, at 13:20, javo wrote: > > > > > thx but setNew(FALSE) won't solve my problem, because I want to create > > new users, not just update them > > > On Aug 26, 12:06 am, "Jim Barcelona" <[EMAIL PROTECTED]> wrote: > >> You can try something like this: > >> $sfGuardUser->setNew(FALSE); > > >>> On Aug 25, 10:49 am, Lee Bolding <[EMAIL PROTECTED]> wrote: > >>>> On 25 Aug 2008, at 09:02, javo wrote: > > >>>>> public function executeUpdate($request) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---