我的岗位模型的schema.yml(Symfony的1.4)学说/ MySQL的关系是这样的:与多列PK台
Post:
columns:
id: { type: bigint, notnull: true, primary: true }
blog_id: { type: bigint, notnull: true, primary: true }
user_id: { type: bigint, notnull: true }
subject: { type: string(255), notnull: true }
short_body: { type: text, notnull: true }
long_body: { type: text }
,你可以看到张贴有一个多列PK。我的问题是“我如何与这个模型创建n:1关系?”
举个例子,我想是这样的:
PostComment:
columns:
post_id: { type: bigint, notnull: true }
blog_id: { type: bigint, notnull: true }
name: { type: string(255), notnull: true }
email: { type: string(255) }
text: { type: text, notnull: true }
relations:
Post:
#Here is my problem. What should I write here?
local: ????
foreign: ????
foreignAlias: Comments
onDelete: cascade
onUpdate: cascade
我如何处理这种关系?
我不熟悉这种表示法,但您需要一对多的表示法。另外postcomment应该有它的ID我猜! – GorillaApe