omnilight\scheduling\Schedule::dueEvents PHP 메소드

dueEvents() 공개 메소드

Get all of the events on the schedule that are due.
public dueEvents ( Application $app ) : Event[]
$app yii\base\Application
리턴 Event[]
    public function dueEvents(Application $app)
    {
        return array_filter($this->_events, function (Event $event) use($app) {
            return $event->isDue($app);
        });
    }

Usage Example

 public function actionRun()
 {
     $this->importScheduleFile();
     $events = $this->schedule->dueEvents(\Yii::$app);
     foreach ($events as $event) {
         $this->stdout('Running scheduled command: ' . $event->getSummaryForDisplay() . "\n");
         $event->run(\Yii::$app);
     }
     if (count($events) === 0) {
         $this->stdout("No scheduled commands are ready to run.\n");
     }
 }