Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.12
-
Fix Version/s: None
-
Component/s: Query
-
Labels:None
Description
See trac #2064 ( http://trac.doctrine-project.org/ticket/2064 )
Jwage wrote "This is expected behavior. We cannot and will not add a fake invalid condition to the where string. I think we need to make it throw an exception if you try and pass an empty array."
I agree that an exception should be thrown.
But AFAIK this hasn't been implemented yet.
The issue is quite urgent in my opinion. Example:
I had a query where I absolutely had to restrict the result set to allowed objects (IDs) only. I used a whereIn() condition for this restriction.
Problem is: when the user wasn't assigned to any groups, the id-array was empty, and Doctrine removed the WHERE ... IN completely! That resulted in a result set containing all records!
I would expect
- either to return no records (correct behavior could be to add "0=1" as a replacement for "... IN ()" expression)
- or let the database decide (= submitting the query with an empty list which would result - at least for MySQL - in a database exception)
- or Doctrine could throw an exception
Would IMO be way better (as its IMO a more expected behavior) than simply not adding the "... IN ()" to the query.
In r6404 this issue was fixed