Skip to content
Advertisement

How to pass data to symfony form class without using static

I’ve got form class and i have to pass args to it but i can’t do that because i am using createNamed function which requires me to use namespace string.

code:

$form = $this->getFormFactory()->createNamed('form', FormType::class, $this->entity);

I can’t pass this data into entity, because it is an arguments for creating the form fields rather than data model.

Advertisement

Answer

Have you tried using the Controller method to pass the data? What about using the constructor?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement