mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
AttributeOverride being ignored for JOINED InheritanceType on Id field when using Query Builder #5030
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 @magickatt on GitHub (Mar 2, 2016).
I've come across what I think is a bug (I've tried to see if there is something I'm doing wrong in terms of the annotations) with how AttributeOverride is being used when trying to query a repository of a child class using the Query Builder.
In this case, the parent class has an Id field with name id, but the child class has an Id field with name application_id. The AttributeOverride seems to work correctly when persisting an object of the child class, but when trying to query a repository (default or custom) using the Query Builder it appears to be trying to join both tables using the overridden field name on both tables, instead of just the child class table
As mentioned this persists correctly when creating new entries, but when trying to query Application\Mortgage I get the following exception because it's trying to join on application_id in both tables, instead of id on r0_ and application_id on r1_
Any idea how this might be solved or what I'm doing wrong? Thanks!
@coder-pm commented on GitHub (Oct 16, 2018):
Did you figure out any workaround?
@fsou commented on GitHub (May 17, 2019):
I've stepped into this problem too.
This issue occurs whenever I try to get either the parent or subclass, switching the Id.
Haven't found any Workaround.
Have found the place where to check if there was an AttributeMapping and set the mappped column name and not the $idColumn.