add new update function
This commit is contained in:
parent
4905190441
commit
769f2dbb14
|
@ -83,9 +83,22 @@ class Record extends AbstractEventManager {
|
|||
$id = $dbh->update($table,$data,$where,true);
|
||||
}
|
||||
|
||||
elseif($where instanceof Sql\Where)
|
||||
elseif($where instanceof Sql\Where || is_callable($where))
|
||||
{
|
||||
try{
|
||||
$adapter = Db::getInstance();
|
||||
|
||||
$sql = new Sql\Sql($adapter);
|
||||
|
||||
$update = $sql->update($table);
|
||||
$update->where($where);
|
||||
$update->set($data);
|
||||
|
||||
$statement = $sql->prepareStatementForSqlObject($update);
|
||||
return $statement->execute();
|
||||
}catch (\Exception $e){
|
||||
throw new RecordException($e->getMessage(),$e->getCode());
|
||||
}
|
||||
}
|
||||
|
||||
elseif(is_array($where))
|
||||
|
|
Loading…
Reference in New Issue