I have a form type that incorporates another form type.
I've added an event-listener to the sub-form but the listener is never executed.
The first Form Type :
class AFormType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('aSubFormType', new SubFormType());
}
//[...]
}
The second Form Type :
class SubFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add("metier", "text");
$builder->addEventListener(
\Symfony\Component\Form\FormEvents::PRE_SET_DATA,
function(\Symfony\Component\Form\FormEvent $event){
// Some Stuff never executed
});
}
}
I don't know if this behaviour is the right or if this is a bug? And how I can use EventListner in sub-form ?
Thanks