-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INSTANCE OF
now behaves correctly by including all possible child classes in IN()
filtering conditions
#1441
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3800 We use Jira to track the state of pull requests and the versions they got |
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.
b3cc880
to
5f16280
Compare
IIRC, the doc mentions that inheritance is not taken into account for this operator. |
There's also an additional problem. If classes are parametrized they won't be converted to slugs since they are passed directly to connection level statement. |
@stof Docs do not say much about "instance of" operator. I found only this reference: http://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html |
quoting @Ocramius in https://groups.google.com/d/msg/doctrine-user/B8raq8CNMgg/kYeSR7gC1Y4J this fix could simplify a lot of existing code, if current behavior it's not mentioned in the docs (so the bug was also undocumented), |
It shouldn't also be considered a BC because if you try to do an |
any chance to merge this? PR was motivated by https://groups.google.com/d/msg/doctrine-user/B8raq8CNMgg/kYeSR7gC1Y4J thanks! |
Hi there... no news here? |
I'm closing this PR in favor of the newer #6392 |
Handled in #6392 |
IN()
filtering conditions
IN()
filtering conditionsINSTANCE OF
now behaves correctly by including all possible child classes in IN()
filtering conditions
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.