This commit is contained in:
thinkphp
2016-11-22 17:24:44 +08:00
parent ee5ef96aac
commit f756bb804e

View File

@@ -1966,14 +1966,14 @@ class Query
// 生成模型对象 // 生成模型对象
$model = $this->model; $model = $this->model;
foreach ($resultSet as $key => $result) { foreach ($resultSet as $key => $result) {
$obj = new $model; /** @var Model $result */
// 支持获取器 $result = new $model($result);
$obj->data($result, true)->isUpdate(true); $result->isUpdate(true);
// 关联查询 // 关联查询
if (!empty($options['relation'])) { if (!empty($options['relation'])) {
$result->relationQuery($options['relation']); $result->relationQuery($options['relation']);
} }
$resultSet[$key] = $obj; $resultSet[$key] = $result;
} }
if (!empty($options['with']) && $result instanceof Model) { if (!empty($options['with']) && $result instanceof Model) {
// 预载入 // 预载入