mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正Connection类
This commit is contained in:
@@ -57,7 +57,7 @@ abstract class Connection
|
||||
// 监听回调
|
||||
protected static $event = [];
|
||||
// 查询对象
|
||||
protected $query;
|
||||
protected $query = [];
|
||||
// 使用Builder类
|
||||
protected $builder;
|
||||
// 数据库连接参数配置
|
||||
@@ -142,9 +142,9 @@ abstract class Connection
|
||||
* @param Query $query 查询对象
|
||||
* @return $this
|
||||
*/
|
||||
public function setQuery($query)
|
||||
public function setQuery($query, $model = 'db')
|
||||
{
|
||||
$this->query = $query;
|
||||
$this->query[$model] = $query;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -154,15 +154,15 @@ abstract class Connection
|
||||
* @access public
|
||||
* @return Query
|
||||
*/
|
||||
public function getQuery()
|
||||
public function getQuery($model = 'db')
|
||||
{
|
||||
if (!isset($this->query)) {
|
||||
if (!isset($this->query[$model])) {
|
||||
$class = $this->config['query'];
|
||||
|
||||
$this->query = new $class($this);
|
||||
$this->query[$model] = new $class($this, 'db' == $model ? '' : $model);
|
||||
}
|
||||
|
||||
return $this->query;
|
||||
return $this->query[$model];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user