1
This commit is contained in:
@@ -541,7 +541,6 @@ 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()))) {
|
||||
echo(sprintf('%s %s %s',$lastId, static::className().'::'.$this->getAutoIncrement(), $this->getLastError()).PHP_EOL);
|
||||
throw new Exception('保存失败.');
|
||||
}
|
||||
$lastId = $this->setPrimary((int)$lastId, $param);
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ class Command extends Component
|
||||
{
|
||||
$pdo = $this->db->getConnect($this->sql);
|
||||
$result = $pdo->execute($this->sql, $isInsert, $this->params);
|
||||
if ($hasAutoIncrement && $result == 0) {
|
||||
if (is_null($hasAutoIncrement) && $result == 0) {
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user