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