DDC-2630: Filters with joined inheritance #3301

Closed
opened 2026-01-22 14:17:43 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 22, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user fvilpoix:

Hello,

I'm trying to use SQLFilter with a Joined Inheritance, and the sql Walker never applies filters on the sub-class, even if I make my SELECT on the sub-class or the root.

In the SqlWalker, the methods 'generateFilterConditionSQL' says :

// The classes in the inheritance will be added to the query one by one,
// but only the root node is getting filtered

I don't understand why, and I would like to know if there is any way to apply filters to subclasses in joined-inheritance.

Thanks a lot :)

Originally created by @doctrinebot on GitHub (Aug 22, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user fvilpoix: Hello, I'm trying to use SQLFilter with a Joined Inheritance, and the sql Walker never applies filters on the sub-class, even if I make my SELECT on the sub-class or the root. In the SqlWalker, the methods 'generateFilterConditionSQL' says : // The classes in the inheritance will be added to the query one by one, // but only the root node is getting filtered I don't understand why, and I would like to know if there is any way to apply filters to subclasses in joined-inheritance. Thanks a lot :)
admin added the ImprovementMissing Tests labels 2026-01-22 14:17:43 +01:00
admin closed this issue 2026-01-22 14:17:43 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2014):

Comment created by holtkamp:

Are you sure you apply the filter on the root Entity? This discussion might be usefull:
https://groups.google.com/forum/#!topic/doctrine-user/e1cPZOorfaQ

@doctrinebot commented on GitHub (Jan 9, 2014): Comment created by holtkamp: Are you sure you apply the filter on the root Entity? This discussion might be usefull: https://groups.google.com/forum/#!topic/doctrine-user/e1cPZOorfaQ
Author
Owner

@aftabnaveed commented on GitHub (Jan 3, 2018):

Does this limitation still exist? $targetEntity will always return the root entity which prevents us adding filters on its subclasses.

@aftabnaveed commented on GitHub (Jan 3, 2018): Does this limitation still exist? $targetEntity will always return the root entity which prevents us adding filters on its subclasses.
Author
Owner

@Ocramius commented on GitHub (Jan 3, 2018):

@aftabnaveed you'd need to write a test case to demonstrate the issue.

@Ocramius commented on GitHub (Jan 3, 2018): @aftabnaveed you'd need to write a test case to demonstrate the issue.
Author
Owner

@beberlei commented on GitHub (Dec 5, 2020):

This is expected and done by design, because generating the SQL to allow filtering on just a join requires some precise parenthesis work that would probably be hard to do.

@beberlei commented on GitHub (Dec 5, 2020): This is expected and done by design, because generating the SQL to allow filtering on just a join requires some precise parenthesis work that would probably be hard to do.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3301