[PR #6392] Correct DQL INSTANCE OF to filter all possible child classes #9963

Closed
opened 2026-01-22 16:06:00 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6392

State: closed
Merged: Yes


This is the rebased version of #1441, which fixes #4646.
Here is the original text:

There was a bug in the "INSTANCE OF" operator as described in
https://groups.google.com/forum/#!topic/doctrine-user/B8raq8CNMgg

"INSTANCE OF" was not taking into account subclasses.
It was merely translating the class to its discriminator.
This is not correct since the class can have subtypes and those
are, indeed, still instance of the superclass.
Also, classes may not have a discriminator (e.g. abstract classes).

This commit also provides useful tests to avoid regression.

**Original Pull Request:** https://github.com/doctrine/orm/pull/6392 **State:** closed **Merged:** Yes --- This is the rebased version of #1441, which fixes #4646. Here is the original text: > There was a bug in the "INSTANCE OF" operator as described in > https://groups.google.com/forum/#!topic/doctrine-user/B8raq8CNMgg > > "INSTANCE OF" was not taking into account subclasses. > It was merely translating the class to its discriminator. > This is not correct since the class can have subtypes and those > are, indeed, still instance of the superclass. > Also, classes may not have a discriminator (e.g. abstract classes). > > This commit also provides useful tests to avoid regression.
admin added the pull-request label 2026-01-22 16:06:00 +01:00
admin closed this issue 2026-01-22 16:06:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9963