This commit is contained in:
2021-01-16 17:12:01 +08:00
parent 4844d2582a
commit 552983c6fd
+2 -2
View File
@@ -385,8 +385,8 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess
$this->afterSave($attributes, $param);
$lastId = $this->refresh();
} catch (\Throwable $exception) {
$lastId = false;
$trance->rollback();
$lastId = $this->addError($exception->getMessage(),'mysql');
}
return $lastId;
}
@@ -411,7 +411,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess
$trance = $command->beginTransaction();
if (!($command = $command->createCommand($sql, $param)->save(false, $this->hasAutoIncrement()))) {
$trance->rollback();
$result = $this->addError($this->getLastError());
$result = false;
} else {
$trance->commit();
$result = $this->refresh();