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