query类查询方法支持闭包

This commit is contained in:
thinkphp
2016-04-16 16:56:42 +08:00
parent b97df6289e
commit 1487ee6eac

View File

@@ -1051,6 +1051,8 @@ class Query
{ {
if ($data instanceof Query) { if ($data instanceof Query) {
return $data->select(); return $data->select();
} elseif ($data instanceof \Closure) {
call_user_func_array($data, [ & $this]);
} }
// 分析查询表达式 // 分析查询表达式
$options = $this->parseExpress(); $options = $this->parseExpress();
@@ -1123,6 +1125,8 @@ class Query
{ {
if ($data instanceof Query) { if ($data instanceof Query) {
return $data->find(); return $data->find();
} elseif ($data instanceof \Closure) {
call_user_func_array($data, [ & $this]);
} }
// 分析查询表达式 // 分析查询表达式
$options = $this->parseExpress(); $options = $this->parseExpress();