/** * Edit a cron * * @param $id The line of the cron in the cron table * @return \Symfony\Bundle\FrameworkBundle\Controller\RedirectResponse|\Symfony\Bundle\FrameworkBundle\Controller\Response */ public function editAction($id) { $cm = new CronManager(); $crons = $cm->get(); $this->addFlash('message', $cm->getOutput()); $this->addFlash('error', $cm->getError()); $form = $this->createForm(new CronType(), $crons[$id]); $request = $this->get('request'); if ('POST' == $request->getMethod()) { $form->bindRequest($request); if ($form->isValid()) { $cm->write(); $this->addFlash('message', $cm->getOutput()); $this->addFlash('error', $cm->getError()); return $this->redirect($this->generateUrl('BCCCronManagerBundle_index')); } } return $this->render('BCCCronManagerBundle:Default:edit.html.twig', array('form' => $form->createView())); }
/** * Suspend a cron from the cron table * * @param $id The line of the cron in the cron table * @return \Symfony\Bundle\FrameworkBundle\Controller\RedirectResponse */ public function suspendAction($id) { $cm = new CronManager(); $crons = $cm->get(); $this->addFlash('message', $cm->getOutput()); $this->addFlash('error', $cm->getError()); $crons[$id]->setSuspended(true); $cm->write(); $this->addFlash('message', $cm->getOutput()); $this->addFlash('error', $cm->getError()); return $this->redirect($this->generateUrl('BCCCronManagerBundle_index')); }