This commit is contained in:
2021-03-26 19:22:54 +08:00
parent f8e2ae5b40
commit c61fe55b4d
+2 -2
View File
@@ -294,10 +294,10 @@ class SqlBuilder extends Component
public function tableName(): string
{
if ($this->query->from instanceof \Closure) {
$this->query->from = '(' . $this->query->makeClosureFunction($this->query->from) . ')';
$this->query->from = $this->query->makeClosureFunction($this->query->from);
}
if ($this->query->from instanceof ActiveQuery) {
$this->query->from = '(' . SqlBuilder::builder($this->query->from)->get($this->query->from) . ')';
$this->query->from = SqlBuilder::builder($this->query->from)->get($this->query->from);
}
if (empty($this->query->from)) {
return $this->query->modelClass::getTable();