[DDC-3907] HAVING clause doesn't recognize column aliases from SELECT clause Created: 18/Sep/15  Updated: 18/Sep/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.5.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Alessandro Lai Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: dql, orm, querybuilder



I've found a strange issue with the HAVING clause. I'll try to summarize this with some line of sample code:

        $qb = $this->createQueryBuilder('tableName');
        $qb->select('COUNT(fieldOne) as countFieldOne');
        $qb->having('1 / countFieldOne > 0');

This piece of code fails. The resulting SQL will have:

    HAVING 1 / countFieldOne > 0

instead of

    HAVING 1 / sclr_0 > 0

The issue is present only when multiply and divide operators are involved. It doesn't appear with sum and subtractions or with a single operator.

[DDC-3553] Create a QueryBuilder from a Query/DQL Created: 01/Feb/15  Updated: 01/Feb/15  Resolved: 01/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: None
Fix Version/s: None

Type: Documentation Priority: Major
Reporter: Dries De Peuter Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: querybuilder



I am searching for a way to create a QueryBuilder from an existing Query or a DQL string.

Can I currently do this?

If this is not the case. I would love to create this but I don't see how to parse the DQL into parts.

Comment by Marco Pivetta [ 01/Feb/15 ]


Not an issue

Note that the QueryBuilder just assembles strings: there is currently no way to transform DQL into a query builder, as the operation is not bijective.

Comment by Dries De Peuter [ 01/Feb/15 ]

I understand. Is their any way you would suggest allowing a DQL to be altered/extended.

Generated at Fri Oct 09 04:52:31 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.