Example #1
0
 /**
  * @param CarJob $carJob
  * @return CtoClient
  */
 public function addCarJob(CarJob $carJob)
 {
     $carJob->setClient($this);
     $this->carJobs->add($carJob);
     return $this;
 }
Example #2
0
 /**
  * @param CarJob $job
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  *
  * @Route("/remove/{id}", name="cto_jobs_remove", requirements={"id"="\d+"})
  * @Method("GET")
  */
 public function removeJobAction(CarJob $job)
 {
     /** @var EntityManager $em */
     $em = $this->getDoctrine()->getManager();
     if (count($job->getNotifications())) {
         $smsSender = $this->get('cto.sms.sender');
         /** @var Notification $notification */
         foreach ($job->getNotifications() as $notification) {
             $smsSender->stop($notification->getResqueJobDescription());
         }
     }
     $em->remove($job);
     $em->flush();
     return $this->redirectToRoute("cto_jobs_list");
 }