Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Find/Show an Especie entity.
- *
- * @Route("/search", name="individuos_showby")
- * @Method("post")
- *
- */
- public function searchAction($query)
- {
- $pattern = '%' . str_replace(' ', '%', $query) . '%';
- $qb = $this->createQueryBuilder('e')->orderBy('e.nombrecomun', 'DESC');
- $qb->where($qb->expr()->orx(
- $qb->expr()->like('e.nombrecomun', ':comun'),
- $qb->expr()->like('e.nombrecientifico', ':cientifico')
- ));
- $qb->setParameters(array('comun' => $pattern, 'cientifico' => $pattern));
- return $qb->getQuery()->execute();
- }
Add Comment
Please, Sign In to add comment