Ticket #1400 (closed defect: invalid)

Opened 10 months ago

Last modified 10 months ago

DQL strips last character off field name

Reported by: magnetik Owned by: romanb
Priority: major Milestone: 1.0.1
Component: Query/Hydration Version: 1.0.0
Severity: Keywords: query parse
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description

Doctrine_Query strips off one character from a field name in my query. See the following:

$designs = Doctrine_Query::create()
            ->from('ContractDesign d')
            ->where('d.id in (SELECT d2.id FROM ContractDesign d2 GROUP BY d2.level HAVING MAX(d2.version)')
            ->orderBy('d.level asc')
            ;

This produces the following SQL:

SELECT c.id AS c__id, c.name AS c__name, c.level AS c__level, c.version AS c__version FROM contract_designs c WHERE c.id in (SELECT c2.id AS c2__id FROM contract_designs c2 GROUP BY c2.level HAVING MAX(c2.versio)) ORDER BY c.level asc

Notice the missing 'n' from the c2.version column name in the HAVING MAX part of the query

I've tested this in 0.10, 0.11 and 1.0.0-RC2

Change History

Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Changed 10 months ago by romanb

  • milestone set to 1.0.1

Changed 10 months ago by jwage

  • status changed from new to closed
  • resolution set to invalid

You have an error in your DQL. Missing the last closing parenthesis. It should be:

$designs = Doctrine_Query::create()
            ->from('ContractDesign d')
            ->where('d.id in (SELECT d2.id FROM ContractDesign d2 GROUP BY d2.level HAVING MAX(d2.version))')
            ->orderBy('d.level asc')
            ;
Note: See TracTickets for help on using tickets.