I have an object model that contains a class with several subclasses.
The subclasses share a few fields from the parent, but they each have
their own fields as well.
I’m using the column_aggregation inheritance type to do this because I
want to be able to polymorphically store objects of the parent class
type, but retrieve objects of the subclass types.
So far, I can retrieve the objects with their subclass types intact.
My problem is that when I call getColumns() on any of the subclass , I
get all the fields for the aggregated table, so I see every field from
all the subclasses together.
Is there a way to only get the fields that actually belong the
subclass?
Design-wise the output of
getColumns()is correct (it merely returns all columns of the aggregated table). I thinkDoctrine_Table->getColumns()is oblivious to the fact that the table in question has sub-classes. Try to useDoctrine_Table->getColumnDefinition()or as a last resortDoctrine_Table->getColumnOwner($column)to infer which columns belong to which sub class.