Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
改进model类的updateFields属性处理
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Feb 20, 2016
1 parent 9b5b4e0 commit 352a4e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ThinkPHP/Library/Think/Model.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,15 @@ public function create($data = '', $type = '')
$fields = $this->insertFields;
} elseif (self::MODEL_UPDATE == $type && isset($this->updateFields)) {
$fields = $this->updateFields;
$pk = $this->getPk();
if (is_string($pk)) {
array_push($fields, $pk);
}
if (is_array($pk)) {
foreach ($pk as $pkTemp) {
array_push($fields, $pkTemp);
}
}
}
if (isset($fields)) {
if (is_string($fields)) {
Expand Down

0 comments on commit 352a4e6

Please sign in to comment.