I'm using Symfony 3.4, I have a FormType
and a Listener for this form on preSubmit
and postSubmit
In my FormType I run the listener like :
$builder->addEventSubscriber(new MyListener());
My problem is, I need in the postSubmit or preSubmit check a condition for get un boolean, and I need this boolean in my controller after the if ($form->isSubmitted() && $form->isValid())
.
My Listener is ok, when I submit the form the listener works well, but I don't knwo how can I get a data from the listener in my controller.
I tried to add a custom non mapped field to the form and set the value in the Listener, but when I try to set the value (true|false) I have an error : "You cannot change value of a submitted form"
I tried something with setData, getData but.. nothing
Any ideas ? Thanks !