Este es el codigo que estoy utilizando
Código PHP:
Form1: Formulario que contiene un form embebido
class AbcMembersContactsParentType extends AbstractType
{
...
->add('contact', new AbcMemberParentNewType(), array(
'data_class' => 'ABC\IsystemBundle\Entity\AbcMembers'
))
...
$resolver->setDefaults(array(
'data_class' => 'ABC\IsystemBundle\Entity\AbcMembersContacts',
'cascade_validation' => true,
'validation_groups' => array('default'),
));
Form2: AbcMemberParentNewType() tiene una colleccion embebida
Código PHP:
class AbcMemberParentNewType extends AbstractType
{
...
->add('member', new AbcMemberType(), array(
'data_class' => 'ABC\IsystemBundle\Entity\AbcMembers'
))
->add('emails', 'collection', array(
'required' => false,
'type' => new AbcMemberEmailType(),
'label' => false,
'by_reference' => false,
//'prototype_data' => new AbcMemberMediaCommunication(),
'allow_delete' => true,
'allow_add' => true,
))
...
$resolver->setDefaults(array(
'data_class' => 'ABC\IsystemBundle\Entity\AbcMembers',
'cascade_validation' => true
//'validation_groups' => array('default'),
));
Form3: colleccion
Código PHP:
class AbcMemberEmailType extends AbstractType
{
...
->add('media','text',array(
'label' => false,
'attr'=>array(
'class'=>'form-control'
)
))
$resolver->setDefaults(array(
'data_class' => 'ABC\IsystemBundle\Entity\AbcMemberMediaCommunication',
'validation_groups' => array('default'),
));