From bba045d69a87444bcb03cee8241509a1885a2ba7 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 2 May 2021 14:46:34 +0800 Subject: [PATCH] modify --- Database/Base/BaseActiveRecord.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index de233768..35d9b698 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -431,19 +431,19 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess [$sql, $param] = SqlBuilder::builder(static::find())->insert($param); - $trance = $dbConnection->beginTransaction(); +// $trance = $dbConnection->beginTransaction(); try { if (!($lastId = (int)$dbConnection->createCommand($sql, $param)->save(true, $this))) { throw new Exception('保存失败.'); } - $trance->commit(); +// $trance->commit(); $lastId = $this->setPrimary($lastId, $param); $this->refresh(); SEvent::trigger(self::AFTER_SAVE, [$attributes, $param]); } catch (\Throwable $exception) { - $trance->rollback(); +// $trance->rollback(); $lastId = $this->addError($exception, 'mysql'); } return $lastId; @@ -498,13 +498,13 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess return $generate; } - $trance = $command->beginTransaction(); +// $trance = $command->beginTransaction(); if (!$command->createCommand(...$generate)->save(false, $this)) { - $trance->rollback(); +// $trance->rollback(); return false; } - $trance->commit(); +// $trance->commit(); $this->refresh();