예제 #1
0
파일: queue.php 프로젝트: thomblin/slimline
 public function updateJob()
 {
     $job = new Job();
     $job->setWorker(0);
     $job->setName($this->name);
     $job->setStart($this->start->format('Y-m-d H:i:s'));
     $job->setCallback($this->class, $this->method, $this->params);
     $job->setUnique($this->unique);
     $this->db->saveModel($job);
 }
예제 #2
0
 /**
  * @covers de\detert\sebastian\slimline\db\Handler::saveModel
  */
 public function testShouldSaveModel()
 {
     $sql = 'CREATE TABLE IF NOT EXISTS `handler_model` (`id` INT(20), `text` VARCHAR(100), PRIMARY KEY (`id`))';
     $this->handler->query($sql);
     $expected = new HandlerModel();
     $expected->fromArray(array('id' => 1, 'text' => 'one'));
     $this->handler->saveModel($expected);
     $actual = $this->handler->loadModel('de\\detert\\sebastian\\slimline\\db\\model\\HandlerModel', array('id' => 1));
     $this->assertEquals($expected->toArray(), $actual->toArray());
     $expected->fromArray(array('id' => 1, 'text' => 'second'));
     $this->handler->saveModel($expected);
     $actual = $this->handler->loadModel('de\\detert\\sebastian\\slimline\\db\\model\\HandlerModel', array('id' => 1));
     $this->assertEquals($expected->toArray(), $actual->toArray());
 }