mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3939: BC Break in 2.5 Cannot add having condition on a non result variable #4817
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Oct 6, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user tkleinhakisa:
Hello,
After upgrading to 2.5.1 the following query does not work anymore:
SELECT COUNT(m.id) as unread, conversation.id FROM Message m INNER JOIN m.conversation conversation LEFT JOIN MessageReading mr WITH mr.conversationId = m.conversation AND mr.user = :user WHERE (mr IS NULL OR m.id > mr.lastRead) AND m.conversation IN(5187, 5186, 5184, 5183, 5171, 5172, 5176, 5150, 5139, 5138) GROUP BY m.conversation
I get the following error:
Cannot add having condition on a non result variable
The change has been introduced by this commit
d9c1782a4fin 2.5.0It was easily fixed by replacing WHERE (mr IS NULL by WHERE (mr.user IS NULL
Either my query was wrong but doctrine supported it when it was not supposed to be, or it's a break to may be worth mentioning in the upgrade file
Thank you
@fnagel commented on GitHub (Oct 26, 2016):
Seems related to #5680
@pdrosos commented on GitHub (Dec 19, 2016):
Hi,
any news for this one? I need it and I can't use it in my query.
@beberlei commented on GitHub (Feb 16, 2020):
Fixed https://github.com/doctrine/orm/pull/6328