parse-community / parse-php-sdk

The PHP SDK for Parse Platform
https://parseplatform.org/
Other
811 stars 346 forks source link

Fix queries equalTo with null values #406

Closed zeliard91 closed 5 years ago

zeliard91 commented 6 years ago
Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? possible
Deprecations? no
Tests pass? yes

Hello,

This fix is meant to correct the behavior when we do an ->equalTo(null) ParseQuery. Before that, it used ->doesNotExist($key) which can work if the attribute has never been set, but if the attribute is set and equals to NULL, then it does not match.

The only workaround I found to effectively query on NULL values before this patch is to do an ->notContainedIn($key, [null]) which is not pretty and not accurate.

I think there is no reason to replace a "IS NULL" query part by a "DOES NOT EXISTS", they both mean something different and the SDK users must choose one or the other according to their needs.

codecov[bot] commented 6 years ago

Codecov Report

Merging #406 into master will decrease coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #406      +/-   ##
==========================================
- Coverage   98.97%   98.97%   -0.01%     
==========================================
  Files          38       38              
  Lines        3117     3114       -3     
==========================================
- Hits         3085     3082       -3     
  Misses         32       32
Impacted Files Coverage Δ
src/Parse/ParseQuery.php 99.41% <100%> (-0.01%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1b99d91...331cd25. Read the comment docs.