This commit is contained in:
2021-03-30 16:03:44 +08:00
parent b57ca5e9ea
commit 9f84636b6c
2 changed files with 267 additions and 262 deletions
+2 -1
View File
@@ -310,7 +310,8 @@ class ActiveQuery extends Component implements ISqlBuilder
/**
* @return bool
* @param bool $getSql
* @return string|bool
* @throws Exception
*/
public function delete($getSql = false): string|bool
+5 -1
View File
@@ -127,7 +127,7 @@ class SqlBuilder extends Component
* @return string
* @throws Exception
*/
public function delete()
public function delete(): string
{
$delete = sprintf('DELETE FROM %s ', $this->query->modelClass::getTable());
@@ -232,6 +232,10 @@ class SqlBuilder extends Component
$select = $this->_selectPrefix();
}
$select = $this->_wherePrefix($select);
if (!empty($this->query->attributes) && is_array($this->query->attributes)) {
$select = strtr($select, $this->query->attributes);
}
if (!empty($this->query->group)) {
$select .= $this->builderGroup($this->query->group);
}