Jira issue originally created by user hosiplan:
Allow filters to add join tables to sql queries for filtering.
Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic and bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.
This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates
Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.
This could be solved by allowing filters to add joins to queries. Should I prepare a pull request?
Comment created by deatheriam:
Comment created by hosiplan:
Because the DDC-2220 is closed.
Comment created by @beberlei:
We won't add this feature.
Issue was closed with resolution "Won't Fix"
I don't understand it... Think about it once again, you've never used inner joins, or left joins with where is null for filtering results?
And I don't what the ugly api that is mentioned in DDC-2220, I wanna addFilterJoin method here, next to addFilterConstraint https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/Filter/SQLFilter.php#L128
Ok then, you're not going to support this, let's assume you have good reasons for it. What are the alternatives? If you give me working filtering alternative based on WHERE statements what won't kill the server performance I'm going to give up on this issue.
Have there at least been some discussion somewhere I can read it? So I can understand why you don't like this? The "We won't add this feature." isn't a reason.
// Btw, jira could really use some comment edits...
[~hosiplan] You can use a subselect, but we cannot extend the filters to add joins for technical reasons. An implementation would raise the complexity for all the code, not just the one affected by filters.
You could try to return a JOIN from 'addFilterConstraint', but I am not sure if that works (and i would recommend it)