예제 #1
0
파일: Saver.php 프로젝트: rawebone/ormish
 protected function tryUpdate($id, Entity $entity)
 {
     list($query, $params) = $this->generator->update($this->table->table(), $entity->changes(), $id, $entity->{$id});
     $this->executor->exec($query, $params);
 }
예제 #2
0
 /**
  * @param \Rawebone\Ormish\Entity $ent
  * @param \Rawebone\Ormish\Table $tbl
  * @param \Rawebone\Ormish\SqlGeneratorInterface $gen
  * @param \Rawebone\Ormish\Executor $ex
  */
 function it_should_try_to_update_and_fail($ent, $tbl, $gen, $ex)
 {
     $tbl->readOnly()->willReturn(false);
     $tbl->id()->willReturn("id");
     $tbl->table()->willReturn("table");
     $ent->id = 1;
     $ent->changes()->willReturn(array());
     $gen->update("table", array(), "id", 1)->willReturn(array("query", array()));
     $ex->exec("query", array())->willThrow(new ExecutionException("", "", "", array()));
     $this->run($ent)->shouldReturn(false);
 }