From 7400b27cb964d797614fc9625d13145bdceb7bf4 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 10 Nov 2021 02:23:14 +0800 Subject: [PATCH] 1 --- src/Base/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Base/Model.php b/src/Base/Model.php index a898b43..240c19f 100644 --- a/src/Base/Model.php +++ b/src/Base/Model.php @@ -540,7 +540,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T { [$sql, $param] = SqlBuilder::builder(static::query())->insert($param); $dbConnection = $this->getConnection()->createCommand($sql, $param); - if (!($lastId = (int)$dbConnection->save(true, $this))) { + if (!($lastId = (int)$dbConnection->save(true, $this->getAutoIncrement()))) { throw new Exception('保存失败.'); } $lastId = $this->setPrimary($lastId, $param);