/**
  * Creates a new ShiftTechnician entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function createAction(Request $request)
 {
     $entity = new ShiftTechnician();
     $entity->setCreation(new \DateTime());
     $form = $this->createForm(new RecuperationEquipmentType(), $entity);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($entity->getShifting()->setCreation(new \DateTime()));
         $em->persist($entity);
         $em->flush();
         if ($this->getRequest()->isXmlHttpRequest()) {
             return new JsonResponse(array());
         }
         return $this->redirect($request->headers->get('referer'));
     }
     return array('entity' => $entity, 'form' => $form->createView(), 'previous' => $request->headers->get('referer'));
 }
 /**
  * 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());
 }