开发者

Doctrine2: Uni-directional @OneToMany with foreign key?

I have a "Product" entity with many "Video" entities, and I only need a unidirectional @OneToMany with foreign key (one product, many videos). My Product-side "key" is not primary or unique, which is why I need it to be unidirectional (eg, "select * from videos where product_family = 2143")

I开发者_高级运维'm using Doctrine 2.1

Is there yet a way to do uni-directional @OneToMany with only a foreign-key in Doctrine 2.1? If not, soon?

UPDATE: I found a relevant quote from Roman Borschel on May 2010:

"this would need quite some special-case handling in many places. In the light that there are 2 reasonably good alternatives (mapping through a jointable or simply making the association bidirectional) we do not consider this something that really needs to be done."

Has this opinion by the Doctrine2 team changed?


OneToMany by design has the related ID on the "Many" side of the relationship. So to make the child table relate to the parent without an additional field in a join table is not possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜