tags:

views:

264

answers:

1

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?

A: 

Design-wise the output of getColumns() is correct (it merely returns all columns of the aggregated table). I think Doctrine_Table->getColumns() is oblivious to the fact that the table in question has sub-classes. Try to use Doctrine_Table->getColumnDefinition() or as a last resort Doctrine_Table->getColumnOwner($column) to infer which columns belong to which sub class.

tedeh
Thanks...I ended up using a different approach to my entity model but this is good to know for the future.
Sam