/**
  * 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();
 }
 /**
  * Creates a new InterventionPlanned entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function createAction(Request $request, Door $door)
 {
     $entity = new Fixing();
     $entity->setCreation(new \DateTime());
     $entity->setDoor($door);
     $entity->setContract($door->getActualContract());
     $entity->setPlace($door . '');
     $entity->setPriority(2);
     $form = $this->get('form.factory')->createNamed('fixingNew' . $door->getId(), new FixingType(), $entity);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($entity);
         $em->flush();
         if ($request->isXmlHttpRequest()) {
             return new JsonResponse(array('id' => $entity->getId()));
         }
         return $this->redirect($this->generateUrl('fixing_show', array('id' => $entity->getId())));
     }
     return array('door' => $door, 'entity' => $entity, 'form' => $form->createView());
 }