I\'m currently trying to use the Symfony2 Form Component though the Silex microframework.
My login form is generated as follows:
$app = $this->app
If you are not using child forms you can set getName
method of your form as empty string:
class FormType extend AbstractType {
// ...
public function getName() {
return '';
}
}
In Symfony3, override AbstractType::getBlockPrefix in child class to return null.
Instead of the createBuilder function use:
$builder = $app['form.factory']->createNamedBuilder(null, 'form', $data, array('validation_constraint' => $constraint));
First parameter being the form name.
Example by Bernhard Schussek himself at https://stackoverflow.com/a/13474522/520114