修正traits\model

This commit is contained in:
thinkphp
2016-01-31 20:55:52 +08:00
parent 1e409b7ddc
commit c8ff8b9f7a
3 changed files with 3 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ trait Auto
// 验证完成生成数据对象 // 验证完成生成数据对象
if ($this->autoCheckFields && empty($this->options['link'])) { if ($this->autoCheckFields && empty($this->options['link'])) {
// 开启字段检测并且没有关联表 则过滤非法字段数据 // 开启字段检测并且没有关联表 则过滤非法字段数据
$fields = $this->getDbFields(); $fields = $this->getFields();
foreach ($keys as $i => $key) { foreach ($keys as $i => $key) {
if (!in_array($key, $fields)) { if (!in_array($key, $fields)) {
unset($data[$key]); unset($data[$key]);

View File

@@ -375,7 +375,7 @@ trait Relation
return false; return false;
} }
if (!empty($this->_link)) { if (!empty($this->_link)) {
$fields = $this->getDbFields(); $fields = $this->getFields();
// 遍历关联定义 // 遍历关联定义
foreach ($this->_link as $key => $val) { foreach ($this->_link as $key => $val) {
// 操作制定关联类型 // 操作制定关联类型

View File

@@ -91,7 +91,7 @@ trait View
{ {
if (false !== $pos = array_search('*', $fields)) { if (false !== $pos = array_search('*', $fields)) {
// 定义所有字段 // 定义所有字段
$fields = array_merge($fields, M($name)->getDbFields()); $fields = array_merge($fields, \think\Loader::model($name)->getFields());
unset($fields[$pos]); unset($fields[$pos]);
} }
return $fields; return $fields;