public function testFactoryByIdMethod() { $job = new TestAction(); $job->insert(); $newJob = Job::factoryById($job->id->getValue()); $this->AssertEquals(get_class($job), get_class($newJob)); }
public function getLastJob() { $jobData = DBSimple::get(Job::TableName, array('status' => Job::NewStatus, 'actionDate <= NOW() '), 'order by `id` asc'); if (!empty($jobData)) { return Job::factory($jobData); } }
protected function action() { $job = Job::factoryById($this->getParam('id')); if ($job->status->getValue() != Job::NewStatus) { return; } $job->status = Job::CanceledStatus; $job->update(); }
public function testAdd() { $fixture = 'hello world!'; $api = new Add(['class' => TestAction::ModelName, 'actionDate' => '', 'hash' => $fixture]); $id = $api->exec(); $new = Job::factoryById($id); $this->assertEquals($new->status->getValue(), TestAction::NewStatus); $this->assertEquals($new->class->getValue(), TestAction::ModelName); $this->assertEquals($new->hash->getValue(), $fixture); }
protected function action() { $orderCond = sprintf('id desc limit 0,%d', $this->limit); $data = DBSimple::select(Job::TableName, [], $orderCond); foreach ($data as $key => $row) { $job = Job::factory($row); $data[$key] = $job->getPreviewParseData(); } return $data; }
public function main() { $fieldInfo = \Extasy\Schedule\Job::getFieldsInfo(); $begin = [self::Title => '#']; $this->outputHeader($begin, self::Title); $view = new \Faid\View\View(__DIR__ . '/dashboard.tpl'); $view->set('statuses', $fieldInfo['fields']['status']['values']); print $view->render(); $this->outputFooter(); $this->output(); }
protected function action() { $originalJob = \Extasy\Schedule\Job::factoryById($this->getParam('id')); if (Job::NewStatus == $originalJob->status->getValue()) { return $originalJob->id->getValue(); } $className = get_class($originalJob); $job = new $className(); $job->hash = $originalJob->hash->getValue(); $job->actionDate->setTime($this->getParam('actionDate')); $job->data = $originalJob->data->getValue(); $job->insert(); return $job->id->getValue(); }
public static function cleanSchedule() { self::dbFixture(Job::getTableName(), array()); }