I have a form type that includes another type of form.
I have added event-listener to the subform, but the listener is never executed.
The first type of form:
class AFormType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('aSubFormType', new SubFormType());
}
}
The second type of form:
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){
});
}
}
I do not know if this behavior is correct or is it a mistake? And how can I use EventListner in a sub form?
thank
Waldo source
share