示例#1
0
 /**
  * Get or create Cron entity for $name.
  *
  * @param string $name
  * @param bool   $create
  *
  * @return Cron
  */
 protected function _getEntity($name, $create = true)
 {
     $entity = $this->_getRepository()->findOneBy(array('name' => $name));
     if ($entity === null && $create) {
         $entity = new Cron();
         $entity->setName($name);
     }
     return $entity;
 }
示例#2
0
 /**
  * Set force to true in Cron entity.
  *
  * @Route("/config/forcecron/{cron}", name="status_force_cron")
  */
 public function setCronForceAction(Cron $cron)
 {
     $cron->setForce(true);
     $this->getDoctrine()->getManager()->flush();
     return $this->redirect($this->generateUrl('status'));
 }