我有两个实体 – 新闻和页面.
定义如下:
定义如下:
/** * Description of Page * @Entity * @InheritanceType("JOINED") * @DiscriminatorColumn(name="type",type="string") * @DiscriminatorMap({ * "news" = "News",* "page" = "Page"}) * * @table( * name="pages" * ) */ class Page extends BaseEntity {...} class News extends Page {...}
我知道,如何只选择“新闻”实体 – 简单的SELECT … FROM News n.
解决方案是在WHERE子句中使用x INSTANCE OF Entity.
http://groups.google.com/group/doctrine-user/browse_thread/thread/b1dc52ed447204e2