public function askImmediateExecution(Process $process, $data) { $em = $this->getEntityManager(); $process->setNextExecutionParameters($data); $process->setNextExecution(new \DateTime()); $process->setPriority(Process::MAX_PRIORITY); $others = $this->getMaxPriorityProcessList(); foreach ($others as $other) { if ($other == $process) { continue; } $other->setPriority(0); } try { $em->flush(); } catch (DBALException $e) { throw new RestApiException(array("save-process" => $e->getMessage())); } }
/** * * @param Process $process */ public function updateNextExecutionDate(Process $process) { $nextExecutionDate = $this->cronNextExecution($process->getCron()); $process->setNextExecution($nextExecutionDate); }