【发布时间】:2015-09-03 12:27:01
【问题描述】:
我在 yaml 文档中使用了一对多、单向和联接表关联,但在数据库中没有创建唯一约束。
我正在使用 postgres。我做错了什么?
这是我的实体,它有两个“一对多、单向和连接表”关联“问题”和“答案”
TestCasesPersistence\Entities\GroupQA:
type: entity
table: group_qa
id:
id:
type: integer
nullable: false
length: null
fixed: false
id: true
column: id
generator:
strategy: IDENTITY
fields:
name:
type: string
nullable: true
length: null
fixed: false
column: name
timeCreated:
type: datetime
nullable: true
column: time_created
manyToMany:
questions:
targetEntity: Question
joinTable:
name: group_qa_questions
joinColumns:
group_qa_id:
referencedColumnName: id
inverseJoinColumns:
question_id:
unique: true
referencedColumnName: id
answers:
targetEntity: Answer
joinTable:
name: group_qa_answers
joinColumns:
group_qa_id:
referencedColumnName: id
inverseJoinColumns:
answer_id:
unique: true
referencedColumnName: id
typeSearches:
targetEntity: TypeSearch
joinTable:
name: group_qa_type_searches
joinColumns:
group_qa_id:
referencedColumnName: id
inverseJoinColumns:
type_search_id:
referencedColumnName: id
lifecycleCallbacks: { }
文档http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html
第 5.6 节
【问题讨论】: