how can I do this?
I’m trying:
$this->form->getObject()->setWebsiteid($website);
$this->form->setDefault('websiteid', $website);
$request->setParameter('websiteid', $website);
none from above doesn’t work
my code:
$this->form = new sfGuardRegisterForm();
if ($request->isMethod('post'))
{
$website=new Website();
$website->save();
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid())
{
/* here I try do that */
$this->form->getObject()->setWebsiteid($website);
/* here I try do that end */
$user = $this->form->save();
$this->getUser()->signIn($user);
$this->redirect('@homepage');
}
}
Is
websiteidpart of yourUsermodel ?Do you use the widget of
websiteidin your form ?You can add the value after the save:
But the first solution seems ok to me..