Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/08/2018, 10:35
nelson12345
 
Fecha de Ingreso: enero-2010
Ubicación: Colombia
Mensajes: 238
Antigüedad: 14 años, 3 meses
Puntos: 2
Pasar parametros de consulta dql

Buenos dias. Estoy tratando de hacer un formulario de consulta pasando un parametro que en este caso es el numero de identificacion del usuario, y lo presento en una pdf, tengo el script pero no me pasa el parametro a la pagina del pdf, si lo escribo manualmente si me arroja el registro pero si lo coloco como variable me sale un error. Alguien que por favor me colabore:

Código HTML:
Ver original
  1. <form action="{{ path('ppp_reportes_usuariosid') }}" target="blank" method="GET">
  2. <input type="text" name="identificacion" class="form-control">
  3. <button class="btn btn-primary" type="submit">Generar</button>


Código PHP:
Ver original
  1. public function usuariosidAction($identificacion ,Request $request)    
  2.     {
  3.  
  4.         $em = $this->getDoctrine()->getManager();
  5.         $dql = "SELECT u FROM PPPCanBundle:Usuario u WHERE u.role != :name AND u.identificacion = :identificacion";
  6.         $usuarios = $em->createQuery($dql);
  7.         $usuarios->setParameter(':name', 'ROLE_PROPIETARIO');
  8.         $usuarios->setParameter(':identificacion', $identificacion);
  9.         $paginator = $this->get('knp_paginator');
  10.         $pagination = $paginator->paginate(
  11.             $usuarios, $request->query->getInt('page', 1),
  12.             10000
  13.         );
  14.  
  15.  
  16.         $snappy = $this->get("knp_snappy.pdf");
  17.         $html = $this->renderView('PPPCanBundle:Reportes:usuariostodos.html.twig', array('pagination' => $pagination));
  18.         //inicio generar pdf        
  19.         $filename = "custom_pdf_from_twig";
  20.         return new Response(
  21.             $snappy->getOutputFromHtml($html),
  22.             200,
  23.             array(
  24.                 'Content-Type' => 'application/pdf',
  25.                 'Content-Disposition' => 'inline; filename="'.$filename.'.pdf"'
  26.                 )
  27.             );
  28.     }

Error:

Controller "PPP\CanBundle\Controller\ReportesController::usua riosidAction()" requires that you provide a value for the "$identificacion" argument (because there is no default value or because there is a non optional argument after this one).