Commit 03206708 by Dirk Adler

Changes mongodb build and condition, fixes #2868

parent 70d495bc
...@@ -772,6 +772,7 @@ class Collection extends Object ...@@ -772,6 +772,7 @@ class Collection extends Object
protected function normalizeConditionKeyword($key) protected function normalizeConditionKeyword($key)
{ {
static $map = [ static $map = [
'AND' => '$and',
'OR' => '$or', 'OR' => '$or',
'IN' => '$in', 'IN' => '$in',
'NOT IN' => '$nin', 'NOT IN' => '$nin',
...@@ -898,13 +899,13 @@ class Collection extends Object ...@@ -898,13 +899,13 @@ class Collection extends Object
*/ */
public function buildAndCondition($operator, $operands) public function buildAndCondition($operator, $operands)
{ {
$result = []; $operator = $this->normalizeConditionKeyword($operator);
$parts = [];
foreach ($operands as $operand) { foreach ($operands as $operand) {
$condition = $this->buildCondition($operand); $parts[] = $this->buildCondition($operand);
$result = array_merge_recursive($result, $condition);
} }
return $result; return [$operator => $parts];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment