Doctrine映射文件错误外键Silex

时间:2017-01-07 10:09:51

标签: file doctrine mapping silex

我目前正在学习Silex并且我在理解方面遇到了问题 如何使用Doctrine管理外键。

我的映射文件有错误:无效的映射文件

我也找到了帮助我的链接:link

这是我的数据库: Database

这是Post

的映射文件
BLOG\Models\Post:


type: entity
  table: posts

  id:
    id:
      type: integer
      generator:
        strategy: auto

  fields:
    title:
      type: string
      length: 255
      column: title
      nullable: false
    date:
      type: datetime
      column: date
      nullable: false
    content:
      type: text
      length: 65535
      column: content
      nullable: false
   manyToOne:
    user:
      targetEntity: User
      mappedBy: Use_id

1 个答案:

答案 0 :(得分:0)

我找到答案归功于link,我必须更改manyToOne部分的代码

  manyToOne:
    user:
      targetEntity: User
      joinColumn:
        name: Use_id
        referencedColumnName: id