I'm trying to get session data into my forms but i don't know how to do.
I could pass it to the constructor of my FormType but the FormType that actually use the session is nested 3 levels deeper in the main form. So i think that it is dirty to pass the session object in each constructor of each form type like this :
->add('name', new NestedFormType($this->session))
I also thought about using formsType as service. So i would have a parent for each of my formsType that should be injected with session.
But how can i do that without defininf all my forms as services ?
Futhermore, i can't access to the DIC inside of my FormTypes. So, it's ok for the creation of the first formType object (which is created in the controller which can access to DIC) but the nested FormTypes cannot be instianciated from their parent.
Is there a clean solution?