This commit is contained in:
2023-12-18 22:00:50 +08:00
parent dc34638a31
commit b77e4be3e8
+1 -2
View File
@@ -435,8 +435,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
*/
private function insert(): bool|static
{
$query = static::query();
$sql = SqlBuilder::builder($query)->insert($this->_attributes);
$sql = SqlBuilder::builder($query = static::query())->insert($this->_attributes);
$lastId = $this->getConnection()->createCommand($sql, $query->params)->save();
if ($lastId === false) {
return false;