mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3652: Problem with joins between entities without associations #4487
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 (Apr 2, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user evaldez:
I needed to write a DQL query that selects an entity that is not specified in the FROM part. For that I am using joins between entities without associations. But I found a problem. Let me explain it with the following example:
Here the query I wrote
This is translated to SQL as:
What happens is that the query gets all the products with the label "Eye cleaners" and the creams having that belong to those products. But it never filters out the products that have no cream association.
To go around the problem I added the condition
in the WHERE clause in the DQL query
After searching for the issue I found something related but no the same. So i decided to put my findings under your consideration.
Thanks a lot
@doctrinebot commented on GitHub (Apr 2, 2015):
@doctrinebot commented on GitHub (Apr 6, 2015):
Comment created by @ocramius:
AND (c3*.product = p2*.id) <---- this should be in the WHERE part!Why should it go in the
WHEREclause? You specified it on a joinWITHcondition, which in ORM terms translates to an additionalONclause