Advertisement
SymfonyRules

PortadaAction

May 21st, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1.     /**
  2.      * @Route("/", name="portadaParkings")
  3.      * @Route("/{ciudad}/{tipo}/",  
  4.      *          name="filtrarParkings")
  5.      * @Template()
  6.      */
  7.     public function portadaAction($ciudad, $tipo)
  8.     {
  9.         $uri = $this->container->get('request')->getPathInfo();
  10.  
  11.         if ($ciudad && $tipo)
  12.         {
  13.  
  14.             $query = $this->parkingsRepository()->filtrarParking($ciudad, $tipo);
  15.  
  16.         }else{
  17.  
  18.             $query = $this->parkingsRepository()->parkings();
  19.         }
  20.         $paginator  = $this->get('knp_paginator');
  21.             $parkings = $paginator->paginate(
  22.                     $query,
  23.                         $this->get('request')->query->get('page', 1)/*page number*/,
  24.                             10/*limit per page*/
  25.                         );
  26.  
  27.         return array('parkings' => $parkings,
  28.                      'tipo' =>$tipo,
  29.                      'ciudad' => $ciudad,
  30.                      );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement