Don't use a formType and you don't need to attach an entity in order to use the Form Builder. Simply use an array instead. You probably overlooked this small section in the Symfony documentation: http://symfony.com/doc/current/form/without_class.html
<?php
// inside your controller ...
$data = array();
$form = $this->createFormBuilder($data)
->add('query', 'text')
->add('category', 'choice',
array('choices' => array(
'judges' => 'Judges',
'interpreters' => 'Interpreters',
'attorneys' => 'Attorneys',
)))
->getForm();
if ($request->isMethod('POST')) {
$form->handleRequest($request);
// $data is a simply array with your form fields
// like "query" and "category" as defined above.
$data = $form->getData();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…