改进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

@@ -124,8 +124,7 @@ class Query
*/
protected function setBuilder()
{
$builder = $this->connection->getConfig('builder') ?: $this->connection->getConfig('type');
$class = false !== strpos($builder, '\\') ? $builder : '\\think\\db\\builder\\' . ucfirst($builder);
$class = $this->connection->getBuilder();
$this->builder = new $class($this->connection, $this);
}