This commit is contained in:
2021-11-10 02:41:39 +08:00
parent ee44cfbca9
commit 6b78d130fb
4 changed files with 11 additions and 25 deletions
+1 -1
View File
@@ -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 = $dbConnection->save(true, $this->getAutoIncrement()))) {
if (!($lastId = $dbConnection->save(true))) {
throw new Exception('保存失败.');
}
$lastId = $this->setPrimary((int)$lastId, $param);