From c20c27bcb829203ab157a4bbd060b2ca776f4003 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 27 Dec 2016 08:15:57 +0800 Subject: [PATCH] =?UTF-8?q?Connection=E7=B1=BBmodel=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BAgetQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 2 +- library/think/db/Connection.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 7c31dc5e..605d48d3 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -178,7 +178,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $connection = []; } // 设置当前模型 确保查询返回模型对象 - $query = Db::connect($connection)->model($model, $this->query); + $query = Db::connect($connection)->getQuery($model, $this->query); // 设置当前数据表和模型名 if (!empty($this->table)) { diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 7392cc1d..e5c60aae 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -137,7 +137,7 @@ abstract class Connection * @param string $queryClass 查询对象类名 * @return Query */ - public function model($model = 'db', $queryClass = '') + public function getQuery($model = 'db', $queryClass = '') { if (!isset($this->query[$model])) { $class = $queryClass ?: $this->config['query']; @@ -155,7 +155,7 @@ abstract class Connection */ public function __call($method, $args) { - return call_user_func_array([$this->model(), $method], $args); + return call_user_func_array([$this->getQuery(), $method], $args); } /**