You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if there is any special null handling in Doctrine's DQL, but SQL:
SELECT id WHERE id NOT IN (NULL)
is basically translated to
SELECT id WHERE id <> NULL
which always returns an empty set, because any comparison operation returns NULL if any operand is NULL, and NULL is further considered as FALSE. (AFAIK this behavior is DB specific and can be configured in some cases, so I wouldn't rely on null handling in any case)
I think that skipping condition is proper solution.
Condition that says that id should not be one from empty set means that id can be arbitrary, but NOT IN (NULL) is opposite, it filters out all results.
Passing an empty array as criteria's parameter, for example:
will result in SQL query containing:
and therefore returning an empty result set, which is quite unexpected.
It might be better to add aditional check for array emptiness and completely skip adding WHERE part to the query in case it's empty.
The text was updated successfully, but these errors were encountered: