/**
  * Displays a form to create a new InterventionPlanned entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function newAction()
 {
     $entity = new ShiftTechnician();
     $entity->setBegin(new \DateTime());
     $shifting = new Equipment();
     $shifting->setPlace('Saint-Soupplets (Bureau)');
     $shifting->setReason('Récupération matériel');
     $entity->setShifting($shifting);
     $form = $this->createForm(new RecuperationEquipmentType(), $entity);
     return array('entity' => $entity, 'form' => $form->createView());
 }
 /**
  * Creates a new ShiftTechnician entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function createAction(Request $request, Shifting $shifting)
 {
     $entity = new ShiftTechnician();
     $entity->setShifting($shifting);
     $entity->setCreation(new \DateTime());
     $form = $this->get('form.factory')->createNamed('shiftTechNew' . $shifting->getId(), new AddTechnicianType(), $entity);
     $form->bind($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($shifting);
         $em->persist($entity);
         $em->flush();
         if ($request->isXmlHttpRequest()) {
             return new JsonResponse(array());
         }
         return $this->redirect($request->headers->get('referer'));
     }
     return array('shifting' => $shifting, 'entity' => $entity, 'form' => $form->createView());
 }