Ticket #614 (closed defect: invalid)
Hydration issues when using IN ()
| Reported by: | jwage | Owned by: | somebody |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.0.0 (OLD) |
| Component: | Other | Version: | |
| Severity: | Keywords: | ||
| Cc: | Has Test: | ||
| Status: | Has Patch: |
Description
Doesn't work
$groupIds = array(1, 2, 3);
$query = new Doctrine_Query();
$query->from('Deal d, d.Groups g');
$query->where('g.id IN (?)', $groupIds);
Does work
$groupIds = array(1, 2, 3);
$query = new Doctrine_Query();
$query->from('Deal d, d.Groups g');
foreach ($groupIds as $group_id)
{
$where .= 'g.id = ' . $group_id . ' or ';
}
$where = substr($where, 0, strlen($where) - 4);
$query->where($where);
The example that doesn't work only returns one Deal record no matter how many are actually returned. When I do $query->getSql() and feed the sql right to the database, more than 1 row is returned. I will try and produce this in a test case and update here.
Change History
Note: See
TracTickets for help on using
tickets.