Here is written how to set the name of a form with a class:
http://symfony.com/doc/2.0/book/forms.html#creating-form-classes
but how to set the name of this
If you're using Symfony 3.1, the field types have changed to use their explicit class (FormType
, TextType
, and EmailType
) and the parameter position for the value of the form name
attribute has switched places with the FormType
parameter in the createNamedBuilder function.
$this->get('form.factory')
->createNamedBuilder('form_name', FormType::class, $defaultData)
->add('name', TextType::class)
->add('email', EmailType::class)
->getForm();