mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
JOINED inheritance not permitting mapping the same column name from both child and parent tables #5903
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 @chewett on GitHub (Feb 26, 2018).
I have a JOINED inheritance mapping where the parent maps the column
foo(which belongs to the parent table) with the variable name$parentfoo,The child then maps the column
foo(which belongs to the child table) with the variable name$childfoo.When I try using this variable doctrine fails with the error "Duplicate definition of column 'foo' on entity 'ChildFooEntity'"
Am I correct in believing that doctrine doesnt support mapping columns with the same name from the parent and child?
I have googled around but cant find any reference to this one way or another. However checking the doctrine code:
if (isset($this->fieldNames[$mapping['columnName']]) || ($this->discriminatorColumn != null && $this->discriminatorColumn['name'] == $mapping['columnName'])) {Its clearly being checked and rejected. Are there any suggestions about how I can map foo in both tables?
Or is it just not possible and I should change the column names?
@Ocramius commented on GitHub (Feb 26, 2018):
We don't expect to support same column names within a same inheritance: it can lead to too many tricky scenarios due to resultset key collisions that we didn't design against.
@chewett commented on GitHub (Feb 26, 2018):
Ok many thanks for the clarification. I will look at getting our DB structure changed.