mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3090: Cannot use single table inheritance in entities deriving from classes using class table inheritance #3835
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 17, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user sparrowek:
I have the following classes:
and these tables:
diet_entries,recipes,ingredients.The idea was not to create the table for supplements since a supplement needs no extra attributes other then those derived from an ingredient, otherwise I would have added Supplement to discriminator map of DietEntry and provided a table for it which is mandatory in JOINED inheritance.
But the problem now is that when a query is build it looks like this:
An exception occurred while executing
SELECT i0*.id AS id0, i0_.name AS name1, i0_.energy AS energy2, d1_.name AS name3, d2_.name AS name4 FROM ingredients i0_ INNER JOIN diet_databases d1_ ON d3_.database_id = d1_.id LEFT JOIN dictionary d2_ ON i0_.group_id = d2_.id WHERE i0*.discriminator IN ('ingredient', 'supplement'){quote}SQLSTATE[42S22]: Column not found: 1054 Unknown column 'i0_.name' in 'field list{quote}
The query for Ingredient is missing a join with the diet_entries table from which the ingredient derives. ORM only sees entities/tables down the inheritance path from the Ingredient class but not up from Ingredient to DietEntry
@doctrinebot commented on GitHub (Apr 17, 2014):
Comment created by @ocramius:
Duplicate of DDC-138
@doctrinebot commented on GitHub (Apr 17, 2014):
Issue was closed with resolution "Duplicate"