Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function removeSchedule(ScheduleInterface $schedule)
 {
     if ($schedule instanceof Schedule) {
         $schedule->setJob(null);
     }
     parent::removeSchedule($schedule);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function process(ScheduleInterface $schedule, \DateTime $currentDateTime = null)
 {
     // ensure that a schedule is not executed twice within in a minute
     $now = $currentDateTime == null ? new \DateTime() : $currentDateTime;
     if ($schedule->getScheduledAt() != null && $schedule->getScheduledAt()->format('Y-m-d H:i') == $now->format('Y-m-d H:i')) {
         return false;
     }
     $cron = $this->expressionFactory->create($schedule->getExpression());
     return $cron->isDue($currentDateTime);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function process(ScheduleInterface $schedule, \DateTime $currentDateTime = null)
 {
     $now = $currentDateTime == null ? new \DateTime() : $currentDateTime;
     if ($schedule->getScheduledAt() !== null) {
         return false;
     }
     if ($schedule->getExpression() < $now->getTimestamp()) {
         return true;
     }
     return false;
 }