Single Table Inheritance with indirect discriminator column (based on database view) #10023
Unanswered
furtivesock
asked this question in
Support Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I want to perform single class inheritance, but the discriminator column can not be accessed directly :
A
has a columnb_id
which refer toid
of TableB
.B
has a columntype
that I would use as a discriminator column.So we've made a SQL view based on
A
withB.type
column (renamedtype
) in it and we have an entityA
based on it.The problem is, insertion works fine as long as columns refer to one table only. But
type
column is also added in the generated query, which causes error.For now, by applying a patch on
doctrine/orm
package, I've added aninsertable
option toDiscriminatorColumn
annotation (similar toinsertable
forColumn
annotation). It works well but it's maybe overkill to do so.Altering table to add a
type
column cannot be an option, so do you have any solution for my case?Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions