Symfony1 同一表上的多个一对多关系原则

Symfony1 同一表上的多个一对多关系原则,symfony1,doctrine,one-to-many,Symfony1,Doctrine,One To Many,我对条令和Yaml有点问题: 这是我的模型: Keyword: columns: word: { type: string, notnull: true } is_stopword: { type: boolean, default: 0 } has_parents: { type: boolean, default: 0 } Relation: columns: child: { type: integer, notnull: true }

我对条令和Yaml有点问题:

这是我的模型:

 Keyword:
  columns:
    word: { type: string, notnull: true }
    is_stopword: { type: boolean, default: 0 }
    has_parents: { type: boolean, default: 0 }

Relation:
  columns:
    child: { type: integer, notnull: true }
    parent: { type: integer, notnull: true }
  relations:
    Keyword: { onDelete: CASCADE, local: [child, parent], foreign: id }    

不知何故,我无法让条令约束这两个关系,只有第一个(子)连接到“关键字”。。。因为一个孩子可以有很多父母,而一个父母可以有很多孩子,这是我看到的唯一解决这个问题的方法。。。任何TIPP?

您必须定义两个关系,一个为父关系,一个为子关系。 此
local:[子,父]
不起作用,对于每个关系,您必须定义一个本地字段和一个外部字段

Relation:
  columns:
    child: { type: integer, notnull: true }
    parent: { type: integer, notnull: true }
  relations:
    ChildKeyword: { onDelete: CASCADE, local: child, foreign: id }
    ParentKeyword: { onDelete: CASCADE, local: parent, foreign: id }