Example #1
0
 /**
  * Get information about schedule
  *
  * @param string $schedule_id Schedule ID
  * @return mixed
  * @throws CException
  */
 public function workerGetSchedule($schedule_id)
 {
     try {
         return $this->_worker->getSchedule($schedule_id);
     } catch (Exception $e) {
         Yii::log('Error in IronWorker: ' . $e->getMessage(), 'error', 'ext.yiiron');
         throw new CException($e->getMessage());
     }
 }
<?php

require_once "phar://../iron_worker.phar";
$worker = new IronWorker();
$worker->debug_enabled = true;
$payload = array('key_one' => 'Payload', 'key_two' => 2);
# 3 minutes later
$start_at = time() + 3 * 60;
# Run task every 2 minutes 10 times
$schedule_id = $worker->postScheduleAdvanced("Scheduling", $payload, $start_at, 2 * 60, null, 10);
# Get schedule information
$schedule = $worker->getSchedule($schedule_id);
print_r($schedule);