/** * 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(); }
/** * Displays a form to create a new InterventionPlanned entity. * * @Template() * @Secure(roles="ROLE_USER") */ public function newAction(Door $door) { /* * Voir aussi * DoorController:stoppedAction * DefaultController:searchAction * @todo A factoriser */ $entity = new Fixing(); $entity->setDoor($door); $entity->setAskDate(new \DateTime()); $form = $this->get('form.factory')->createNamed('fixingNew' . $door->getId(), new FixingType(), $entity); return array('door' => $door, 'entity' => $entity, 'form' => $form->createView()); }