This commit is contained in:
2021-02-23 18:12:17 +08:00
parent 75e79915f7
commit 9712cfcb50
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -411,11 +411,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
$trance = $dbConnection->beginTransaction();
try {
$commandExec = $dbConnection->createCommand($sqlBuilder, $param);
if (($lastId = $commandExec->save(true, $this)) === false) {
if (!($lastId = (int)$commandExec->save(true, $this))) {
throw new Exception('保存失败.' . $sqlBuilder);
}
$trance->commit();
$this->setPrimary($lastId = (int)$lastId, $param);
$this->setPrimary($lastId, $param);
$this->event->dispatch(self::AFTER_SAVE, [$attributes, $param]);
} catch (\Throwable $exception) {