I am trying to create a simple search form that uses an entity type to create the form.
private function createCreateForm()
{
return $this->createFormBuilder()
->setAction($this->generateUrl('search_results'))//->add('search', 'search')
->add('professions','entity', array(
'class' => 'AppBundle:Profession',
'property' => 'name',
'multiple' => true,
'expanded' => true))
->add('submit', 'submit')
->getForm();
}
This work perfectly and my form has the checkboxes created from my database records.
However, when I try to handle the request on POST - it just hangs and does nothing!
public function resultAction(Request $request)
{
$form = $this->createCreateForm();
$form->handleRequest($request);
$professions = $form->getData();
print_r($professions);
}
All I wanted to retrieve was an array of the select options so I could perform a search query with them.
If I just create an array of values, it works fine which makes me wonder if it is hanging as it attempts to resolve the entity relationship on handleRequest()?
Any ideas would be greatly appreciated!
Thanks.