mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进Model类的save方法 修正不按主键查询的更新问题
This commit is contained in:
@@ -667,6 +667,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
if (!empty($where)) {
|
||||
$pk = $this->getPk();
|
||||
if (is_string($pk) && isset($data[$pk])) {
|
||||
if (!isset($where[$pk])) {
|
||||
unset($where);
|
||||
$where[$pk] = $data[$pk];
|
||||
}
|
||||
unset($data[$pk]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user