Hi,
I'm posting my problem here because I could not find any help in the
documentation, IRC or forums. Here it is :
I have two tables, mpp_fournisseur and mpp_personne. There is a
foreign key between them, called pe_id (in both). I would like to have
a page with two forms corresponding to each table. So I generated one
CRUD per class, the forms and I tried to embed the second form into
the first one. It is working quite well :
public function executeUpdate($request)
{
$this->forward404Unless($request->isMethod('post'));
$this->form = new
MppFournisseurForm(MppFournisseurPeer::retrieveByPk($request-
>getParameter('id')));
$this->form2 = new
MppPersonneForm(MppPersonnePeer::retrieveByPk($request-
>getParameter('id')));
$this->form->bind($request->getParameter('mpp_fournisseur'));
$this->form2->bind($request->getParameter('mpp_personne'));
if ($this->form->isValid() && $this->form2->isValid())
{
$mpp_personne = $this->form2->save();
$mpp_fournisseur = $this->form->save();
$this->redirect('fournisseur/index');
}
$this->setTemplate('index');
}
But when I submit the form, the first one (mpp_fournisseur) doesn't
have the pe_id. I would like to add the entry ($this->form2->save();),
retrieve the id created, and add this id into the pe_id field for the
first form, and then make a $this->form->save();
I tried several methods :
$mpp_personne = $this->form2->save();
$this->form->setDefault('pe_id', $mpp_personne->getId());
$mpp_fournisseur = $this->form->save();
Allthough I get no error, the id is still empty in my tables. Do you
see what's wrong?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---