public function listAction($page)
 {
     $em = $this->getDoctrine()->getManager();
     $rpp = $this->container->getParameter('readings_per_page');
     $repo = $em->getRepository('trrsywxBundle:BookHeadline');
     list($res, $totalcount) = $repo->getResultAndCount($page, $rpp);
     $paginator = new \tr\rsywxBundle\Utility\Paginator($page, $totalcount, $rpp);
     $pagelist = $paginator->getPagesList();
     return $this->render('trrsywxBundle:Readings:ReadingList.html.twig', array('page' => $page, 'res' => $res, 'paginator' => $pagelist, 'cur' => $page, 'total' => $paginator->getTotalPages()));
 }
 public function searchAction(Request $req)
 {
     $q = $req->request->all();
     $page = 1;
     $key = $q['key'];
     $em = $this->getDoctrine()->getManager();
     $rpp = $this->container->getParameter('books_per_page');
     $repo = $em->getRepository('trrsywxBundle:BookBook');
     list($res, $totalcount) = $repo->getResultAndCount($page, $rpp, $key);
     $paginator = new \tr\rsywxBundle\Utility\Paginator($page, $totalcount, $rpp);
     $pagelist = $paginator->getPagesList();
     return $this->render('trrsywxBundle:Books:List.html.twig', array('res' => $res, 'paginator' => $pagelist, 'cur' => $page, 'total' => $paginator->getTotalPages(), 'key' => $key));
 }