I have similar problem with propel.
Mine related forms are saved if I use the whole $form['emgeded_form']
to output all my entries, but if I try to customize the form by doing:
$form['emgeded_form']['']
$form['emgeded_form']['']
...
related forms return null id after saving.
But this is
This does not fail validation, and it saves both objects; but it
doesn't save them related to each other. The Email['user_id'] is left
null after this form submittal.
I have submitted a ticket for this: http://trac.symfony-project.org/ticket/4906
-- Stephen Ostrow <[EMAIL PROTECTED]>
On Nov 11
This works: http://pastebin.com/m1db73fde
I think though that this should work:
class UserForm extends BaseUserForm
{
public function configure()
{
foreach ($this->getObject()->getEmails() as $email)
{
$this->embedForm('Emails[' . $email['id'] . ']', new
EmailForm($email));
Jon,
Thanks for the quick reply.
With my knowledge of Doctrine, that's what I assumed the first error
which is why I had tried Email[] and I had tried Email[0] before that
as well. When I tried your code I get the same problem as with just
Email[]
{{{
Unexpected extra form field named "Email"
Well, you get that error because when you embed it with a name of Email, it
tries to set something to a Doctrine record which is a collection, and you
are passing it a single piece of data.
Try:
for ($i = 0; $i < 5; $i++)
{
$form->embedForm('Email[' . $i . ']', new EmailForm());
}
On Tue, Nov