コード例 #1
0
 /**
  * 
  * @param Work $intervention
  * @throws LogicException
  */
 public function __construct(Work $intervention, $options = array())
 {
     if ($intervention->getQuote() === null) {
         throw new LogicException('Aucun devis lié a ces travaux');
     }
     parent::__construct($intervention->getQuote(), $options);
     $this->intervention = $intervention;
 }
コード例 #2
0
 public function buildPriority()
 {
     $this->work->setPriority(3);
 }
コード例 #3
0
 /**
  * Finds and displays a InterventionPlanned entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function emailAction(Work $entity, $step)
 {
     $request = $this->getRequest();
     $steps = array('planned' => 'JLM\\DailyBundle\\Builder\\Email\\WorkPlannedMailBuilder', 'onsite' => 'JLM\\DailyBundle\\Builder\\Email\\WorkOnSiteMailBuilder', 'end' => 'JLM\\DailyBundle\\Builder\\Email\\WorkEndMailBuilder');
     $class = array_key_exists($step, $steps) ? $steps[$step] : null;
     if (null === $class) {
         throw new NotFoundHttpException('Page inexistante');
     }
     $mail = MailFactory::create(new $class($entity));
     $editForm = $this->createForm(new MailType(), $mail);
     $editForm->handleRequest($request);
     if ($editForm->isValid()) {
         $this->get('mailer')->send(MailFactory::create(new MailSwiftMailBuilder($editForm->getData())));
         $this->get('event_dispatcher')->dispatch(JLMModelEvents::DOOR_SENDMAIL, new DoorEvent($entity->getDoor(), $request));
         return $this->redirect($this->generateUrl('work_show', array('id' => $entity->getId())));
     }
     return array('entity' => $entity, 'form' => $editForm->createView(), 'step' => $step);
 }