I'd like to know if there is anyway to get a query result from the text areas that have been filled while some have not.
Example:
$form = $this->get('form.factory')->create(new UsersType(), new Users())
->add('firstname', 'text', array('required' => false, 'label' => 'First name '))
->add('lastname', 'text', array('required' => false, 'label' => 'Last name '))
;
$idm = $em->getRepository('MyBundle:Users')->findBy(
array('number' => $form->get('number')->getData(),
'firstname' => $form->get('firstname')->getData(),
'lastname' => $form->get('lastname')->getData()
));
I would like that it ignores the texts which have not been filled and execute a query only with the filled texts.
Thank you!
Aucun commentaire:
Enregistrer un commentaire