Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function OfferIndex(Request $request)
- {
- $em = $this->getDoctrine()->getManager();
- $queryBuilder = $em->getRepository('BackBundle:offer')->createQueryBuilder('o');
- if (isset($_REQUEST['offerKey'])) {
- $queryBuilder
- ->where('CONCAT(o.name,o.technologies) LIKE :title')
- ->setParameter('title', '%' . $_REQUEST['offerKey'] . '%');
- }
- $query = $queryBuilder->getQuery();
- $paginator = $this->get('knp_paginator');
- $pagination = $paginator->paginate(
- $query, /* query NOT result */
- $request->query->getInt('page', 1)/*page number*/,
- 2/*limit per page*/
- );
- return $this->render('FrontBundle:pages:Offre d'emploi et de stage .html.twig',array(
- 'pagination' => $pagination
- ));
- }
- <form method="post" id="filtres" action="{{ path('offer/list') }}">
- <div class="filter with-reset-search">
- <input type="text" placeholder="Mots clés" id="offerKey" name="offerKey"/>
- <span class="reset-search">
- <svg version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"><g id="icons" fill="#0064b9"><path
- d="M14.8,12l3.6-3.6c0.8-0.8,0.8-2,0-2.8c-0.8-0.8-2-0.8-2.8,0L12,9.2L8.4,5.6c-0.8-0.8-2-0.8-2.8,0 c-0.8,0.8-0.8,2,0,2.8L9.2,12l-3.6,3.6c-0.8,0.8-0.8,2,0,2.8C6,18.8,6.5,19,7,19s1-0.2,1.4-0.6l3.6-3.6l3.6,3.6 C16,18.8,16.5,19,17,19s1-0.2,1.4-0.6c0.8-0.8,0.8-2,0-2.8L14.8,12z"
- id="exit"></path></g></svg>
- </span>
- </div>
- $queryBuilder
- ->where('CONCAT(o.name,o.technologies) LIKE :title')
- ->setParameter('title', '%' . $_REQUEST['offerKey'] . '%');
Add Comment
Please, Sign In to add comment