[DBAL-442] Break the query building with multiple from parts Created: 10/Feb/13 Updated: 22/Apr/13 Resolved: 22/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | None |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Denis Vasilev | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | mysql | ||
| Description |
|
For example:
$queryBuilder
->select('DISTINCT c.id')
->from('Campaigns', 'c')
->leftJoin('c', 'CampaignOperations', 'od', 'od.campaignId = c.id AND od.operation = :operation')
->from('BannerGroups', 'bg')
->innerJoin('bg', 'BannerGroupStrategies', 'bgs', 'bgs.groupId = bg.id AND bgs.advSystem = :system')
->where('bg.campaignId = c.id');
Builded the query: SELECT DISTINCT c.id FROM Campaigns s LEFT JOIN CampaignOperations od ON (od.campaignId = c.id AND od.operation = :operation) INNER JOIN BannerGroupStrategies bgs ON (bgs.groupId = bg.id AND bgs.advSystem = :system), BannerGroups bg WHERE (bg.campaignId = c.id) If this query execute on mysql, we get error: Expected result: SELECT DISTINCT c.id FROM Campaigns s LEFT JOIN CampaignOperations od ON (od.campaignId = c.id AND od.operation = :operation), BannerGroups bg INNER JOIN BannerGroupStrategies bgs ON (bgs.groupId = bg.id AND bgs.advSystem = :system) WHERE (bg.campaignId = c.id) Regression after patch https://github.com/doctrine/dbal/pull/175 |
| Comments |
| Comment by Denis Vasilev [ 10/Feb/13 ] |
| Comment by Fabio B. Silva [ 22/Apr/13 ] |
|
Fixed by : https://github.com/doctrine/dbal/commit/99574240f332a814ec193b6e7a88abb6a457f061 |