model类的setField方法忽略数据副本

This commit is contained in:
thinkphp
2016-02-21 11:37:28 +08:00
parent b7632a5a52
commit e16cb705ba
2 changed files with 5 additions and 5 deletions

View File

@@ -680,6 +680,8 @@ class Model
} else { } else {
$data[$field] = $value; $data[$field] = $value;
} }
// 更新某个字段的时候 忽略数据副本
$this->duplicate = [];
return $this->save($data); return $this->save($data);
} }
@@ -709,7 +711,6 @@ class Model
$step = '-' . $step; $step = '-' . $step;
} }
} }
$this->duplicate = [];
return $this->setField($field, ['exp', $field . '+' . $step]); return $this->setField($field, ['exp', $field . '+' . $step]);
} }
@@ -739,7 +740,6 @@ class Model
$step = '-' . $step; $step = '-' . $step;
} }
} }
$this->duplicate = [];
return $this->setField($field, ['exp', $field . '-' . $step]); return $this->setField($field, ['exp', $field . '-' . $step]);
} }

View File

@@ -145,13 +145,13 @@ class View
* *
* @param string $template 模板文件名或者内容 * @param string $template 模板文件名或者内容
* @param array $vars 模板输出变量 * @param array $vars 模板输出变量
* @param array $cache 模板缓存参数 * @param array $config 模板参数
* @param bool $renderContent 是否渲染内容 * @param bool $renderContent 是否渲染内容
* *
* @return string * @return string
* @throws Exception * @throws Exception
*/ */
public function fetch($template = '', $vars = [], $cache = [], $renderContent = false) public function fetch($template = '', $vars = [], $config = [], $renderContent = false)
{ {
// 模板变量 // 模板变量
$vars = $vars ? $vars : $this->data; $vars = $vars ? $vars : $this->data;
@@ -175,7 +175,7 @@ class View
is_file($template) ? include $template : eval('?>' . $template); is_file($template) ? include $template : eval('?>' . $template);
} else { } else {
// 指定模板引擎 // 指定模板引擎
$this->engine->fetch($template, $vars, $cache); $this->engine->fetch($template, $vars, $config);
} }
// 获取并清空缓存 // 获取并清空缓存
$content = ob_get_clean(); $content = ob_get_clean();