DDC-1591: Paginator: ResultVariable cannot be used in HavingClause #2228

Closed
doctrinebot opened this Issue Jan 9, 2012 · 11 comments

2 participants

@doctrinebot

Jira issue originally created by user craue:

Using the QueryBuilder, I'm getting the message

Notice: Undefined index: distance in vendor\doctrine\lib\Doctrine\ORM\Query\SqlWalker.php line 2128

when trying to add a "having" clause for the field "distance", which is defined in the "select" part of the statement:

$queryBuilder
    ->select('myEntity, MY_FUNCTION() AS distance')
    ->having('distance <= 10')
;
@doctrinebot

Comment created by @FabioBatSilva:

Christian, I couldn't reproduce.

Can you give more details ?

Thanks.

@doctrinebot

Comment created by craue:

I tried it again and found out that it could also be an issue in https://github.com/whiteoctober/Pagerfanta rather in Doctrine itself because my query is passed to that pager to show a sliced result. Maybe that issue could already be resolved by whiteoctober/Pagerfanta#46. Will give it a try...

@doctrinebot

Comment created by craue:

In fact, applying that patch made the query work. So this is not a Doctrine issue.

@doctrinebot

Comment created by craue:

Since the PR mentioned was not merged and Doctrine's pagination is used now, the issue still exists and I cannot use a result variable in a "having" clause. But I'd like to. ;)

@doctrinebot

Comment created by stof:

This ticket is indeed invalid as it is talking about the query builder. Please open a dedicated ticket for the pagination issue

@doctrinebot

Comment created by craue:

But I am using the QueryBuilder and then passing the query to a DoctrineORMAdapter instance. The error message didn't change, just the line number:

Notice: Undefined index: distance in vendor\doctrine\lib\Doctrine\ORM\Query\SqlWalker.php line 2142

But I can confirm that this error doesn't occur when not using a paginator. How to continue?

@doctrinebot

Comment created by @beberlei:

Which paginator are you using?

@doctrinebot

Comment created by craue:

Still https://github.com/whiteoctober/Pagerfanta/ ;)

@doctrinebot

Comment created by @beberlei:

Renamed and assigned issue.

@doctrinebot

Comment created by @asm89:

Fixed as sander was kind enough to resubmit the code to the doctrine2 repository now instead:
#298

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.3 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment