Skip to content

Commit bef9085

Browse files
zeliard91dplewis
authored andcommitted
Fix queries equalTo with null values (#406)
1 parent 34638fd commit bef9085

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/Parse/ParseQuery.php

100755100644
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ public function get($objectId, $useMasterKey = false)
112112
*/
113113
public function equalTo($key, $value)
114114
{
115-
if ($value === null) {
116-
$this->doesNotExist($key);
117-
} else {
118-
$this->where[$key] = $value;
119-
}
115+
$this->where[$key] = $value;
120116

121117
return $this;
122118
}

tests/Parse/ParseQueryTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,11 +2207,20 @@ function ($i) {
22072207
return $obj;
22082208
}
22092209
);
2210+
$this->saveObjects(
2211+
2,
2212+
function ($i) {
2213+
$obj = ParseObject::create('TestObject');
2214+
$obj->set('num', null);
2215+
2216+
return $obj;
2217+
}
2218+
);
22102219
$query = new ParseQuery('TestObject');
22112220
$query->equalTo('num', null);
22122221
$results = $query->find();
22132222
$this->assertEquals(
2214-
0,
2223+
2,
22152224
count($results),
22162225
'Did not return correct number of objects.'
22172226
);

0 commit comments

Comments
 (0)