I've found a technique to insert data in two entities with one form here:
http://forum.symfony-project.org/viewtopic.php?f=23&t=42011
My problem is that getData()
return an array of objects and I can't use it with the persist()
method because it expects an object. How can I fix it?
You might be looking for something like this:
$data = $form->getData();
foreach ($data as $object) {
$em->persist($object);
}
$em->flush();