Development

#3145 (Enabling quote_identifier breaks some Doctrine queries)

You must first sign up to be able to contribute.

Ticket #3145 (new defect)

Opened 4 months ago

Last modified 4 months ago

Enabling quote_identifier breaks some Doctrine queries

Reported by: dball Assigned to: jwage
Priority: minor Milestone:
Component: sfDoctrinePlugin Version:
Keywords: quote_identifier doctrine Cc: jwage@centresource.com
Qualification: Unreviewed

Description

If quote_identifier is set to true, some Doctrine queries break. For example:

    $query = new Doctrine_Query();
    $query->select('q.id, q.body, COUNT(ea.id) experts, COUNT(sa.id) students')
          ->from('Question q')
          ->leftJoin('q.Answers ea WITH ea.expert = 1')
          ->leftJoin('q.Answers sa WITH sa.expert = 0')
          ->groupby('q.id');

The table aliases used in the ON clauses do not match the table aliases declared in the LEFT JOIN clauses, e.g. this SQL (after adding where and limit clauses):

SELECT DISTINCT `q2`.`id` FROM `question` `q2` LEFT JOIN `answer` `a3` ON `q2`.`id` = `a3`.`question_id` AND a.expert = 1 LEFT JOIN `answer` `a4` ON `q2`.`id` = `a4`.`question_id` AND a2.expert = 0 WHERE `q2`.`role_id` = ? GROUP BY `q2`.`id` LIMIT 5

Change History

03/17/08 21:29:03 changed by dball

  • owner changed from chtito to jwage.