protected function newJobFound(EntityManager $em, OutputInterface $output, Command $command, CronJobAnno $anno, $defaultDisabled = false)
 {
     $newJob = new CronJob();
     $newJob->setCommand($command->getName());
     $newJob->setDescription($command->getDescription());
     $newJob->setInterval($anno->value);
     $newJob->setNextRun(new \DateTime());
     $newJob->setEnabled(!$defaultDisabled);
     $output->writeln("Added the job " . $newJob->getCommand() . " with interval " . $newJob->getInterval());
     $em->persist($newJob);
 }
示例#2
0
 protected function newJobFound(EntityManager $em, OutputInterface $output, Command $command, CronJobAnno $anno, $defaultDisabled = false)
 {
     $nextRun = $this->getNextRun($anno);
     $newJob = new CronJob();
     $newJob->setCommand($command->getName());
     $newJob->setDescription($command->getDescription());
     $newJob->setInterval($anno->interval);
     $newJob->setNextRun($nextRun);
     $newJob->setEnabled(!$defaultDisabled);
     $output->writeln("Added the job " . $newJob->getCommand() . " with interval " . $newJob->getInterval() . " with the next run at " . $nextRun->format('Y-m-d H:i:s'));
     $em->persist($newJob);
 }