Model类增加resultSetType属性 用于指定模型查询的数据集对象(默认为空返回数组) Db类查询不再支持设置自定义数据集对象(只能使用数组或者think\Collection)

This commit is contained in:
thinkphp
2016-12-05 16:24:02 +08:00
parent 30077757bd
commit 405825ff8a
3 changed files with 23 additions and 25 deletions

View File

@@ -489,10 +489,7 @@ abstract class Connection
$result = $this->PDOStatement->fetchAll($this->fetchType);
$this->numRows = count($result);
if (!empty($class)) {
// 返回指定数据集对象类
$result = new $class($result);
} elseif ('collection' == $this->resultSetType) {
if ('collection' == $this->resultSetType) {
// 返回数据集Collection对象
$result = new Collection($result);
}