DDC-1166: Undefined index when using INSTANCE OF operator and inheritance #1464

Closed
opened 2026-01-22 13:15:17 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (May 23, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user comfortablynumb:

Hi,

Having a class tree like this:

. Element
. Activity (JOINED)
. ActivityMail (SINGLE)
. ActivityPhoneCall (SINGLE)
. ActivityXXX (SINGLE)
. OtherEntity

Doing a query similar to:

"SELECT element FROM Model\Element element WHERE element INSTANCE OF Model\ActivityMail"

I receive:

PHP Notice: Undefined index: Model\ActivityMail in /var/www/gestion/vendor/doctrine/lib/Doctrine/ORM/Query/SqlWalker.php on line 1683

But no error. And it doesn't return instances of ActivityMail. Even if I do:

"SELECT element FROM Model\Element element WHERE element INSTANCE OF Model\Activity"

It doesn't throw the notice, but it doesn't return any results either.

Thanks in advance.

Originally created by @doctrinebot on GitHub (May 23, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user comfortablynumb: Hi, Having a class tree like this: . Element . Activity (JOINED) . ActivityMail (SINGLE) . ActivityPhoneCall (SINGLE) . ActivityXXX (SINGLE) . OtherEntity Doing a query similar to: "SELECT element FROM Model\Element element WHERE element INSTANCE OF Model\ActivityMail" I receive: PHP Notice: Undefined index: Model\ActivityMail in /var/www/gestion/vendor/doctrine/lib/Doctrine/ORM/Query/SqlWalker.php on line 1683 But no error. And it doesn't return instances of ActivityMail. Even if I do: "SELECT element FROM Model\Element element WHERE element INSTANCE OF Model\Activity" It doesn't throw the notice, but it doesn't return any results either. Thanks in advance.
admin added the Bug label 2026-01-22 13:15:17 +01:00
admin closed this issue 2026-01-22 13:15:18 +01:00
Author
Owner

@doctrinebot commented on GitHub (May 23, 2011):

Comment created by comfortablynumb:

I realized that what I thought it was a SINGLE inheritance, it's really a JOINED inheritance. And I had two inheritance mapping configurations in both, Element and Activity entities. So I had:

. Element (JOINED)
. Activity (JOINED - I had annotations for this too. THAT was the problem)
. Email
. Fax
. OtherEntity

Having only mapped inheritance on Element entity works like a charm. I tried to use SINGLE inheritance on Activity first sometime ago, and then I realized that it doesn't work. So I changed it to JOINED and it worked. But I didn't realized that I didn't need to map again the JOINED inheritance for the Activity's children.

Looking at this issue, is there a chance to add an exception when a user, like me, tries to map an inheritance tree twice, or when he/she tries to map two different types of inheritance in the same class tree? it could avoid this types of issues.

@doctrinebot commented on GitHub (May 23, 2011): Comment created by comfortablynumb: I realized that what I thought it was a SINGLE inheritance, it's really a JOINED inheritance. And I had two inheritance mapping configurations in both, Element and Activity entities. So I had: . Element (JOINED) . Activity (JOINED - I had annotations for this too. THAT was the problem) . Email . Fax . OtherEntity Having only mapped inheritance on Element entity works like a charm. I tried to use SINGLE inheritance on Activity first sometime ago, and then I realized that it doesn't work. So I changed it to JOINED and it worked. But I didn't realized that I didn't need to map again the JOINED inheritance for the Activity's children. Looking at this issue, is there a chance to add an exception when a user, like me, tries to map an inheritance tree twice, or when he/she tries to map two different types of inheritance in the same class tree? it could avoid this types of issues.
Author
Owner

@doctrinebot commented on GitHub (May 23, 2011):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (May 23, 2011): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1464