/**
  * @Route("/operation/apply/{id}/{timeslot}", name="operation_apply")
  * @Template()
  */
 public function applyOperationAction($id, $timeslot)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->getUser();
     $operation = $em->getRepository('CharlestownOperationBundle:Operation')->find($id);
     $timeslot = $em->getRepository('CharlestownOperationBundle:Timeslot')->find($timeslot);
     $application = new OperationAppliance();
     $application->setEvent($user);
     $application->setOperation($operation);
     $application->setTimeslot($timeslot);
     $em->persist($application);
     $em->flush();
     //        $this->get('charlestown.mailer')->sendOperationNotificationMail($application); Désactiver car on envoie plus d'email aux RC
     $this->get('charlestown.mailer')->sendOperationApplianceMail($application);
     return $this->redirect($this->generateUrl('mission_operation'));
 }
Exemplo n.º 2
0
 public function sendOperationApplianceMail(OperationAppliance $appliance)
 {
     $user = $appliance->getEvent();
     $appliance = $appliance->getOperation()->getName();
     $template = $this->parameters['template']['operation'];
     $rendered = $this->templating->render($template, array('appliance' => $appliance));
     $this->sendEmailMessage($rendered, $user->getEmail());
 }
Exemplo n.º 3
0
 public function removeAppliance(OperationAppliance $appliance)
 {
     $this->appliances->removeElement($appliance);
 }