Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Lists all Article entities.
- *
- * @Route("/search/{q}", name="article_search")
- * @Method("GET")
- */
- public function searchAction($q)
- {
- $em = $this->getDoctrine()->getManager();
- $query = $em->createQuery("SELECT a FROM AppBundle\Entity\Product a WHERE a.title LIKE '%$q%'");
- $products = $query->getResult(); // array of Company objects
- return $this->render('product/search.html.twig', array(
- 'products' => $products,
- 'query' => $q
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment