Skip to content

Commit

Permalink
改进Builder类的parseData方法 对 对象的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Nov 4, 2016
1 parent 582b35e commit 04548b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Builder
// 最后插入ID
protected $insertId = [];
// 查询表达式
protected $exp = ['<>' => 'ne', 'neq' => 'ne', '=' => 'eq', '>' => 'gt', '>=' => 'gte', '<' => 'lt', '<=' => 'lte', 'in' => 'in', 'not in' => 'nin', 'nin' => 'nin', 'mod' => 'mod', 'exists' => 'exists', 'regex' => 'regex', 'type' => 'type', 'all' => 'all', '> time' => '> time', '< time' => '< time', 'between' => 'between', 'not between' => 'not between', 'between time' => 'between time', 'not between time' => 'not between time', 'notbetween time' => 'not between time', 'like' => 'like','near' => 'near'];
protected $exp = ['<>' => 'ne', 'neq' => 'ne', '=' => 'eq', '>' => 'gt', '>=' => 'gte', '<' => 'lt', '<=' => 'lte', 'in' => 'in', 'not in' => 'nin', 'nin' => 'nin', 'mod' => 'mod', 'exists' => 'exists', 'regex' => 'regex', 'type' => 'type', 'all' => 'all', '> time' => '> time', '< time' => '< time', 'between' => 'between', 'not between' => 'not between', 'between time' => 'between time', 'not between time' => 'not between time', 'notbetween time' => 'not between time', 'like' => 'like', 'near' => 'near'];

/**
* 架构函数
Expand Down Expand Up @@ -91,7 +91,9 @@ protected function parseData($data, $options)
$result = [];
foreach ($data as $key => $val) {
$item = $this->parseKey($key);
if (isset($val[0]) && 'exp' == $val[0]) {
if (is_object($val)) {
$result[$item] = $val;
} elseif (isset($val[0]) && 'exp' == $val[0]) {
$result[$item] = $val[1];
} elseif (is_null($val)) {
$result[$item] = 'NULL';
Expand Down

0 comments on commit 04548b8

Please sign in to comment.