Skip to content

Commit

Permalink
Fixes #5081
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Nov 5, 2014
1 parent 8533409 commit be0866f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Database/Expression/QueryExpression.php
Expand Up @@ -483,7 +483,11 @@ protected function _addConditions(array $conditions, array $types) {
continue;
}

if ($c instanceof self && count($c) > 0) {
if ($c instanceof self && count($c) === 0) {
continue;
}

if ($numericKey && $c instanceof ExpressionInterface) {
$this->_conditions[] = $c;
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -513,7 +513,8 @@ public function testOrConditionsWithExpression() {
$query = $table->find();
$query->where([
'OR' => [
new \Cake\Database\Expression\Comparison('id', 1, 'integer', '>')
new \Cake\Database\Expression\Comparison('id', 1, 'integer', '>'),
new \Cake\Database\Expression\Comparison('id', 3, 'integer', '<')
]
]);

Expand Down

0 comments on commit be0866f

Please sign in to comment.