doctrine/doctrine1 — Issue #47: Using ->limit() in conjunction with many-to-many with mysql generates wrong SQL
Author: smileua
Created: 2011-11-29 23:34:23+00:00
State: open

Using ->limit() in conjunction with many-to-many relationships with mysql leads to strange SQL generated. The condition **id IS NULL** is added in such case which is not correct at all.

Please have a look at https://github.com/smileua/doctrine-issue where a simple sandbox is created to easily reproduce this bug with more verbose description.

Seems like here's code which causes the bug https://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Query.php#L1307
which refers to some issue #1868 on trac I assume.

> FIX #1868: If not ID under MySQL is found to be restricted, restrict pk column for null
(which will lead to a return of 0 items)

But it's not possible to find that issue to know what it is about. Trac doesn't work, such services like google cache, web archive didn't help.