File 条令映射文件错误外键Silex

File 条令映射文件错误外键Silex,file,doctrine,mapping,silex,File,Doctrine,Mapping,Silex,我目前正在学习Silex,在理解方面有问题 如何使用条令管理外键 映射文件出错:映射文件无效 我还发现了这个链接,它帮助了我: 这是我的数据库: 这是帖子的映射文件 BLOG\Models\Post: type: entity table: posts id: id: type: integer generator: strategy: auto fields: title: type: string

我目前正在学习Silex,在理解方面有问题 如何使用条令管理外键

映射文件出错:映射文件无效

我还发现了这个链接,它帮助了我:

这是我的数据库:

这是帖子的映射文件

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

多亏了这一点,我才找到了答案,我不得不更改我的多功能部件代码

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