开发者

Cannot generate a module for a model without a primary key

开发者 https://www.devze.com 2023-01-26 12:22 出处:网络
I have a Heading table/model and I also have a \"heading\" module. When I go to the heading module, which has worked fine in the past, it now gives me this error:

I have a Heading table/model and I also have a "heading" module. When I go to the heading module, which has worked fine in the past, it now gives me this error:

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

This is odd to me because my schema.yml for Heading looks like this:

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

Note the primary key:

  columns:
    id:
     开发者_运维知识库 type: integer(8)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true

I suspect it has something to do with this other problem I'm having. Any ideas?


Turns out the problem was that I had defined HeadingTable::getTables() and HeadingTable::getColumns(). Doctrine didn't like that.

0

精彩评论

暂无评论...
验证码 换一张
取 消