没有主键的模型无法生成模块

时间:2010-11-19 15:16:58

标签: symfony1 doctrine

我有一个标题表/模型,我还有一个“标题”模块。当我转到过去运行良好的标题模块时,它现在给了我这个错误:

Cannot generate a module for a model without a primary key (Heading)

这对我来说很奇怪,因为我的标题的schema.yml看起来像这样:

Heading:
  connection: doctrine
  tableName: heading
  columns:
    id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    referenced_table_name:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    column_name:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    label:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    position:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      notnull: true
      autoincrement: false
    import_profile_id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    note:
      type: string()
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    created_at:
      type: timestamp(25)
      fixed: false
      unsigned: false
      primary: false
      default: '0000-00-00 00:00:00'
      notnull: true
      autoincrement: false
    updated_at:
      type: timestamp(25)
      fixed: false
      unsigned: false
      primary: false
      default: '0000-00-00 00:00:00'
      notnull: true
      autoincrement: false
  relations:
    ImportProfile:
      local: import_profile_id
      foreign: id
      type: one
    TotalFromFile:
      local: id
      foreign: heading_id
      type: many

请注意主键

  columns:
    id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true

我怀疑它与this other problem I'm having有关。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

原来问题是我定义了HeadingTable::getTables()HeadingTable::getColumns()。学说不喜欢这样。