dtmwnqng38644 2009-12-14 18:46
浏览 66
已采纳

Doctrine - 检索子类中的字段列表会聚合所有字段

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?

  • 写回答

1条回答 默认 最新

  • dslkchyv673627 2009-12-23 18:11
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式