doctrine命令行工具出错

时间:2010-11-26 00:21:14

标签: database doctrine yaml

更新
我现在回到先前的教义构建,现在错误是:

Invalid schema element named "Roles" at path "RoleResource->columns->relations"

这是同一个yaml文件(见下文)


我的doctrine命令行工具有问题。当我发出命令“build-all-reload”时,我得到以下错误:

SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'role_id' doesn't exist in table. Failing Query: "CREATE TABLE resource (id BIGINT AUTO_INCREMENT, name VARCHAR(20), INDEX role_id_idx (role_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB". Failing Query: CREATE TABLE resource (id BIGINT AUTO_INCREMENT, name VARCHAR(20), INDEX role_id_idx (role_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = INNODB

我的yaml文件如下所示:

detect_relations: true

options:
  type: INNODB
  collate: utf8_general_ci
  charset: utf8

Log:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    priority: tinyint
    priorityName: string(10)
    title: string(250)
    message: text
  actAs:
    Timestampable:
      created:
        type: timestamp
        format: Y-m-d H:i:s
      updated:
        disabled: true

User:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    username: string(50)
    password: string(40)
  actAs:
    Timestampable:
      created:
        type: timestamp
        format: Y-m-d H:i:s
      updated:
        type: timestamp
        format: Y-m-d H:i:s

Role:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    name: string(20)
  attributes:
    export: all
    validate: true

RoleResource:
  columns:
    role_id:
      type: integer
      primary: true
    resource_id:
      type: integer
      primary: true
    relations:
      Role:
        foreignAlias: RoleResource
      Resource:
        foreignAlias: RoleResource

Resource:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    name: string(20)
  relations:
    Roles:
      foreignAlias: Resources
      class: Role
      refClass: RoleResource

Menu:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    label: string(20)

Artical:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    title: string
    content: longtext
    css: longtext
    js: longtext

我不知道如何解决这个问题 有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我降级了Doctrine。

在yaml文件中有太多空格添加行:

relations:

来自组件“RoleResource:”

感谢Tom的所有帮助,

Ivo Trompert