Skip to content

Instantly share code, notes, and snippets.

@garak
Created January 9, 2012 16:28
Show Gist options
  • Save garak/1583690 to your computer and use it in GitHub Desktop.
Save garak/1583690 to your computer and use it in GitHub Desktop.
/**
* @Route("/search/prova")
* @Template()
* @return array
*/
public function provaAction()
{
$form = $this->createFormBuilder()
->add('type', 'choice', array('required' => false, 'choices' => array(
'' => '',
'uno' => '1',
'due' => '2',
'tre' => '3',
)))->getForm();
$vars = array('form' => $form->createView(), 'res' => array());
if ($request->getMethod() == 'POST') {
$form->bindRequest($request);
if ($form->isValid()) {
$data = $form->getData();
$repo = $this->getDoctrine()->getRepository('GarakGarakBundle:stocazzo');
$vars['cards'] = $repo
->createQueryBuilder('c')
->getQuery()
->getResult();
}
}
return $vars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment