学说命令行工具出错

发布于 2024-10-04 21:07:15 字数 2480 浏览 4 评论 0原文

更新
我现在已经回到以前构建的学说,现在错误是:

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

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


我对学说命令行工具有疑问。当我发出命令“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

我不知道如何解决此问题。
有人可以帮我吗?

Update
I have now go back to a previous build of doctrine and now the error is:

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

this is whit the same yaml file (see it below)


I have a problem with the doctrine command line tool. When I give the command "build-all-reload", I get te following error:

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

My yaml file looks like this:

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

I don't know how to solve this problem.
Can someone please help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2024-10-11 21:07:15

我降级了教义。

并且 yaml 文件中的空格太多,请添加以下行:

relations:

来自组件“RoleResource:”

感谢您的所有帮助 Tom、

Ivo Trompert

I downgraded Doctrine.

And there are to spaces to much in the yaml file add the line:

relations:

from the component "RoleResource:"

Thank you for all the help Tom,

Ivo Trompert

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文