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:
->select('myEntity, MY_FUNCTION() AS distance')
->having('distance <= 10')
Comment created by @FabioBatSilva:
Christian, I couldn't reproduce.
Can you give more details ?
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...
In fact, applying that patch made the query work. So this is not a Doctrine issue.
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. ;)
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
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?
Comment created by @beberlei:
Which paginator are you using?
Still https://github.com/whiteoctober/Pagerfanta/ ;)
Renamed and assigned issue.
Comment created by @asm89:
Fixed as sander was kind enough to resubmit the code to the doctrine2 repository now instead:
Issue was closed with resolution "Fixed"