/**
  * Ajoute un technicien sur une intervention
  * @Secure(roles="ROLE_USER")
  * @Template()
  */
 public function newAction(Shifting $shifting)
 {
     $entity = new ShiftTechnician();
     $entity->setBegin(new \DateTime());
     $form = $this->get('form.factory')->createNamed('shiftTechNew' . $shifting->getId(), new AddTechnicianType(), $entity);
     return array('shifting' => $shifting, 'entity' => $entity, 'form' => $form->createView(), 'id' => $shifting->getId());
 }
 /**
  * Supprimer une intervention
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function deleteAction(Shifting $entity)
 {
     $em = $this->getDoctrine()->getManager();
     foreach ($entity->getShiftTechnicians() as $tech) {
         $em->remove($tech);
     }
     $em->remove($entity);
     $em->flush();
     return $this->redirect($this->generateUrl('intervention_today'));
 }
예제 #3
0
 /**
  * Get place
  * @return string
  */
 public function getPlace()
 {
     return null === ($door = $this->getDoor()) ? parent::getPlace() : $door->getType() . ' - ' . $door->getLocation() . chr(10) . $door->getAddress()->toString();
 }