From 72d9b84475522e2a3235e7e93c4200472eb37758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 26 Mar 2021 15:44:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/SqlBuilder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Database/SqlBuilder.php b/Database/SqlBuilder.php index 1eaf293d..0adbcfb9 100644 --- a/Database/SqlBuilder.php +++ b/Database/SqlBuilder.php @@ -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) . ')';