This commit is contained in:
2021-11-10 02:33:54 +08:00
parent fcfc2213c2
commit 2f3be8cabc
+1 -1
View File
@@ -541,7 +541,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()))) {
var_dump($lastId, $this->getAutoIncrement(), $this->getLastError());
file_put_contents('php://input',sprintf('%s %s %s',$lastId, static::className().'::'.$this->getAutoIncrement(), $this->getLastError()).PHP_EOL);
throw new Exception('保存失败.');
}
$lastId = $this->setPrimary((int)$lastId, $param);