改进Query类的setBuilder方法 避免因自定义连接器类后找不到生成器类

This commit is contained in:
thinkphp
2017-01-26 13:55:01 +08:00
parent 2ef5da7b1b
commit 55b99355d7
2 changed files with 17 additions and 2 deletions

View File

@@ -58,6 +58,8 @@ abstract class Connection
protected static $event = [];
// 查询对象
protected $query = [];
// 使用Builder类
protected $builder;
// 数据库连接参数配置
protected $config = [
// 数据库类型
@@ -148,6 +150,20 @@ abstract class Connection
return $this->query[$model];
}
/**
* 获取当前连接器类对应的Builder类
* @access public
* @return string
*/
public function getBuilder()
{
if (!empty($this->builder)) {
return $this->builder;
} else {
return $this->getConfig('builder') ?: '\\think\\db\\builder\\' . ucfirst($this->getConfig('type'));
}
}
/**
* 调用Query类的查询方法
* @access public