改进where和whereor闭包查询

This commit is contained in:
thinkphp
2016-05-23 18:02:32 +08:00
parent 03f49b8461
commit 71d5e668d1
2 changed files with 2 additions and 1 deletions

View File

@@ -263,6 +263,7 @@ abstract class Builder
} }
} }
} }
$whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str); $whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str);
} }
return $whereStr; return $whereStr;

View File

@@ -727,7 +727,7 @@ class Query
protected function parseWhereExp($operator, $field, $op, $condition, $param = []) protected function parseWhereExp($operator, $field, $op, $condition, $param = [])
{ {
if ($field instanceof \Closure) { if ($field instanceof \Closure) {
call_user_func_array($field, [ & $this]); $this->options['where'][$operator][] = $field;
return; return;
} }