我怎样才能做到这一点?
我正在努力:
$this->form->getObject()->setWebsiteid($website);
$this->form->setDefault('websiteid', $website);
$request->setParameter('websiteid', $website);
上面的任何一个都不起作用
我的代码:
$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');
}
}