This commit is contained in:
2021-03-26 15:44:28 +08:00
parent 146ac4f3a1
commit 72d9b84475
+2 -3
View File
@@ -265,9 +265,8 @@ class SqlBuilder extends Component
public function tableName(): string
{
if ($this->query->from instanceof \Closure) {
$activeQuery = new ActiveQuery($this->query->modelClass);
call_user_func($this->query->from, $activeQuery);
$this->query->from = '(' . $activeQuery->toSql() . ')';
call_user_func($this->query->from, $activeQuery = new Sql());
$this->query->from = '(' . $activeQuery->getSql() . ')';
}
if ($this->query->from instanceof ActiveQuery) {
$this->query->from = '(' . SqlBuilder::builder($this->query->from)->get($this->query->from) . ')';