/** * Search * @Secure(roles="ROLE_USER") * @Template() */ public function searchAction(Request $request) { $formData = $request->get('jlm_core_search'); if (is_array($formData) && array_key_exists('query', $formData)) { $em = $this->getDoctrine()->getManager(); $doors = $em->getRepository('JLMModelBundle:Door')->search($formData['query']); /* * Voir aussi * DoorController:stoppedAction * FixingController:newAction -> utiliser formModal * @todo A factoriser de là ... */ $fixingForms = array(); foreach ($doors as $door) { $form = new Fixing(); $form->setDoor($door); $form->setAskDate(new \DateTime()); $fixingForms[] = $this->get('form.factory')->createNamed('fixingNew' . $door->getId(), new FixingType(), $form)->createView(); } /* à la */ return array('query' => $formData['query'], 'doors' => $doors, 'fixing_forms' => $fixingForms); } return array(); }
/** * Imprime le rapport d'intervention * * @Secure(roles="ROLE_USER") */ public function printdayAction(Fixing $entity) { $response = new Response(); $response->headers->set('Content-Type', 'application/pdf'); $response->headers->set('Content-Disposition', 'inline; filename=report-' . $entity->getId() . '.pdf'); $response->setContent($this->render('JLMDailyBundle:Fixing:printreport.pdf.php', array('entity' => $entity))); return $response; }