Please keep in mind that all the form logic should be done inside the form, the form is self dependant
So this code should be avoid : $this->form->setDefaults($this->getUser()->getProfile()); you can provide to your UserEditForm the sfUser Object, and then overwrite the method updateDefaultsFromObject to define the default values. On Wed, Dec 10, 2008 at 6:01 PM, Peter Bowyer <[EMAIL PROTECTED]>wrote: > > Hi, > > I have set up sfGuardDoctrine with a separate profile table (as per > the symfony blog tutorials) and written a user registration form. > > However... I now want to write a form where registered users can > update their profile. I have tried modifying the registration form > but I cannot get the nested Profile form to be populated. > > In my action I currently have: > $this->form = new UserEditForm($this->getUser()->getGuardUser()); > $this->form->setDefaults($this->getUser()->getProfile()); > > and my UserEditForm looks like: > -------8<------------ > class UserEditForm extends sfGuardUserForm > { > public function configure() > { > > parent::configure(); > $profileForm = new ProfileForm(); > unset($profileForm['id'], $profileForm['sf_guard_user_id']); > $this->embedForm('Profile', $profileForm); > > // Remove all widgets we don't want to show > unset( > $this['is_active'], > $this['is_super_admin'], > $this['updated_at'], > $this['groups_list'], > $this['permissions_list'], > $this['last_login'], > $this['created_at'], > $this['salt'], > $this['algorithm'], > $this['username'], > $this['password'] > ); > } > } > -------8<------------ > > Now I'm guessing I could just edit the ProfileForm directly and > there's no need to go through the sfGuardUser (despite the two being > linked) but humour me - is there a way to do it this way? I imagine > to change the password at the same time this way would need to be > used anyhow... > > Thanks, > Peter > > > > > -- Thomas Rabaix Internet Consultant --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---