SINGLE_TABLE Inheritance breaks with optional ManyToOne relationship in subclass #5636

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

Originally created by @GDIBass on GitHub (Aug 12, 2017).

Originally assigned to: @GDIBass on GitHub.

When using single table inheritance with an optional ManyToOne relationship the referenced entity is loaded with no data whatsoever. You have to reload the entity from the database in order to get it to load any of the appropriate data. Here is a repository link with a working example:

https://bitbucket.org/GDIBass/relationalsingletableinheritancedoctrinebug/overview

Originally created by @GDIBass on GitHub (Aug 12, 2017). Originally assigned to: @GDIBass on GitHub. When using single table inheritance with an optional ManyToOne relationship the referenced entity is loaded with no data whatsoever. You have to reload the entity from the database in order to get it to load any of the appropriate data. Here is a repository link with a working example: https://bitbucket.org/GDIBass/relationalsingletableinheritancedoctrinebug/overview
admin added the BugIncompleteMissing Tests labels 2026-01-22 15:13:25 +01:00
admin closed this issue 2026-01-22 15:13:25 +01:00
Author
Owner

@lcobucci commented on GitHub (Aug 13, 2017):

@GDIBass thank you for submitting this issue with that working example but it would be far more helpful if you could send us a PR with a failing test case. This isolates everything and makes it easier to solve the problem.

You can find examples on 388afb46d0/tests/Doctrine/Tests/ORM/Functional/Ticket.

@lcobucci commented on GitHub (Aug 13, 2017): @GDIBass thank you for submitting this issue with that working example but it would be far more helpful if you could send us a PR with a failing test case. This isolates everything and makes it easier to solve the problem. You can find examples on https://github.com/doctrine/doctrine2/tree/388afb46d0cb3ed0c51332e8df0de9e942c2690b/tests/Doctrine/Tests/ORM/Functional/Ticket.
Author
Owner

@GDIBass commented on GitHub (Aug 13, 2017):

@lcobucci Will do. Should I name mine GH6622?

@GDIBass commented on GitHub (Aug 13, 2017): @lcobucci Will do. Should I name mine GH6622?
Author
Owner

@GDIBass commented on GitHub (Aug 14, 2017):

I can't get it to replicate with the tests. Perhaps it's something with Symfony? I'll get something on Stack Exchange

@GDIBass commented on GitHub (Aug 14, 2017): I can't get it to replicate with the tests. Perhaps it's something with Symfony? I'll get something on Stack Exchange
Author
Owner

@Ocramius commented on GitHub (Aug 14, 2017):

@GDIBass closing here - please re-open once reproduced only with the ORM.

@Ocramius commented on GitHub (Aug 14, 2017): @GDIBass closing here - please re-open once reproduced only with the ORM.
Author
Owner

@Ocramius commented on GitHub (Aug 14, 2017):

Check also https://github.com/doctrine/doctrine2/pull/1194 meanwhile

@Ocramius commented on GitHub (Aug 14, 2017): Check also https://github.com/doctrine/doctrine2/pull/1194 meanwhile
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5636