jeudi 9 avril 2015

Symfony2: update a form from event and get an object

I have a form and a listener within it. As I have "choices" fields whose available value may depend on other field's values, I listen to the PRE_SUBMIT event. There, I re-create the choice fields with the new value.


In this listener, to analyse the user data, I do:



$event->getData()


But, from this event, it returns me an array. The constraint is that I need an object, in order to compute the available values. As far as I know, from the SUBMIT event I could get an object, but fields cannot be added any more to the form.


Is there no way to get an object ?


Aucun commentaire:

Enregistrer un commentaire