From 8f4642ae83918a0d405cf1eba762e57e501830cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 26 Mar 2021 19:41:44 +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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Database/SqlBuilder.php b/Database/SqlBuilder.php index 1004f939..34b68e08 100644 --- a/Database/SqlBuilder.php +++ b/Database/SqlBuilder.php @@ -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 = sprintf('(%s)', $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 = sprintf('%s', SqlBuilder::builder($this->query->from)->get($this->query->from)); } if (empty($this->query->from)) { return $this->query->modelClass::getTable();