这就是我的代码片段的样子。
// --- 这是我控制器中的代码 ----
$registrationForm = $this->createFormBuilder()
->add('email')
->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'Passwords do not match'))
->getForm();
return $this->render('AcmeHelloBundle:Default:index.html.twig', array('form' => $registrationForm->createView()));
// --- This is the twig file code----
<form action="#" method="post" {{ form_enctype(form) }}>
{{ form_errors(form) }}
{{ form_row( form.email, { 'label': 'E-Mail:' } ) }}
{{ form_errors( form.password ) }}
{{ form_row( form.password.first, { 'label': 'Your password:' } ) }}
{{ form_row( form.password.second, { 'label': 'Repeat Password:' } ) }}
{{ form_rest( form ) }}
<input type="submit" value="Register" />
</form>
任何人都可以建议为什么它不能使用表单生成器工作吗?