改名
This commit is contained in:
@@ -411,11 +411,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
$trance = $dbConnection->beginTransaction();
|
$trance = $dbConnection->beginTransaction();
|
||||||
try {
|
try {
|
||||||
$commandExec = $dbConnection->createCommand($sqlBuilder, $param);
|
$commandExec = $dbConnection->createCommand($sqlBuilder, $param);
|
||||||
if (($lastId = $commandExec->save(true, $this)) === false) {
|
if (!($lastId = (int)$commandExec->save(true, $this))) {
|
||||||
throw new Exception('保存失败.' . $sqlBuilder);
|
throw new Exception('保存失败.' . $sqlBuilder);
|
||||||
}
|
}
|
||||||
$trance->commit();
|
$trance->commit();
|
||||||
$this->setPrimary($lastId = (int)$lastId, $param);
|
$this->setPrimary($lastId, $param);
|
||||||
|
|
||||||
$this->event->dispatch(self::AFTER_SAVE, [$attributes, $param]);
|
$this->event->dispatch(self::AFTER_SAVE, [$attributes, $param]);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class Command extends Component
|
|||||||
if ($result == 0 && $hasAutoIncrement->hasAutoIncrement()) {
|
if ($result == 0 && $hasAutoIncrement->hasAutoIncrement()) {
|
||||||
return $this->addError($connection->errorInfo()[2], 'mysql');
|
return $this->addError($connection->errorInfo()[2], 'mysql');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result == 0 ? true : $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user