public function testFactoryMethod() { $row = ['class' => TestAction::ModelName, 'id' => 1, 'status' => TestAction::NewStatus]; $job = Job::factory($row, $this->jobRepository); // $this->AssertTrue($job instanceof TestAction); }
public function insert(Job $job) { foreach ($this->data as $key => $row) { $isSameClass = $job->class->getValue() == $row->class->getValue(); $isSameHash = $job->hash->getValue() == $row->hash->getValue(); $isSameStatus = $job->status->getValue() == $row->status->getValue(); if ($isSameClass && $isSameHash && $isSameStatus) { $this->data[$key] = $row; $job->setData($this->data[$key]->getData()); return; } } $job->id = $this->incrementValue; $this->incrementValue++; $this->data[] = $job; }
/** * @return Job[] */ public function getActual() { $jobData = DBSimple::get(self::TableName, array('status' => Job::NewStatus, 'actionDate <= NOW() '), 'order by `id` asc'); if (!empty($jobData)) { return Job::factory($jobData); } return null; }