Php Symfony从模型生成数据库

Php Symfony从模型生成数据库,php,mysql,symfony1,yaml,Php,Mysql,Symfony1,Yaml,我在生成简单的数据库表单模型时遇到问题。我正在使用: 关于Symfony 1.4.4的原则 MySQL Workbench 5.2.16,具有0.4.2dev的条令导出功能 因此,我的ERL模型是: 通用YAML文件: --- detect_relations: true options: collate: utf8_unicode_ci charset: utf8 type: InnoDB Course: columns: id: type: int

我在生成简单的数据库表单模型时遇到问题。我正在使用:

  • 关于Symfony 1.4.4的原则
  • MySQL Workbench 5.2.16,具有0.4.2dev的条令导出功能
因此,我的ERL模型是:

通用YAML文件:

---
detect_relations: true
options:
  collate: utf8_unicode_ci
  charset: utf8
  type: InnoDB

Course:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    name:
      type: string(255)
      notnull: true
    keywords:
      type: string(255)
      notnull: true
    summary:
      type: clob(65535)
      notnull: true

Lecture:
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    course_id:
      type: integer(4)
      primary: true
      notnull: true
    name:
      type: string(255)
      notnull: true
    description:
      type: string(255)
      notnull: true
    url:
      type: string(255)
  relations:
    Course:
      class: Course
      local: course_id
      foreign: id
      foreignAlias: Lectures
      foreignType: many
      owningSide: true

User:
  columns:
    id:
      type: integer(4)
      primary: true
      unique: true
      notnull: true
      autoincrement: true
    firstName:
      type: string(255)
      notnull: true
    lastName:
      type: string(255)
      notnull: true
    email:
      type: string(255)
      unique: true
      notnull: true
    designation:
      type: string(1024)
    personalHeadline:
      type: string(1024)
    shortBio:
      type: clob(65535)

UserCourse:
  tableName: user_has_course
  columns:
    user_id:
      type: integer(4)
      primary: true
      notnull: true
    course_id:
      type: integer(4)
      primary: true
      notnull: true
  relations:
    User:
      class: User
      local: user_id
      foreign: id
      foreignAlias: UserCourses
      foreignType: many
      owningSide: true
    Course:
      class: Course
      local: course_id
      foreign: id
      foreignAlias: UserCourses
      foreignType: many
      owningSide: true
无论我尝试什么,这个错误都会发生在:

symfony doctrine:build --all --no-confirmation

SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'user_userid' doesn't exist in table. Failing Query: "ALTER TABLE user_has_course ADD CONSTRAINT user_has_course_user_userid_user_id FOREIGN KEY (user_userid) REFERENCES user(id)". Failing Query: ALTER TABLE user_has_course ADD CONSTRAINT user_has_cou
rse_user_userid_user_id FOREIGN KEY (user_userid) REFERENCES user(id)

目前我正在学习Symfony,并且一直在学习这个错误。请提供帮助。

确保将InnoDB用作MyISAM模式的引擎,其他人不支持外键。

确保将InnoDB用作MyISAM模式的引擎,其他人不支持外键。

正如错误中所述:“user.user\u id”列不存在。在您的关系中,您引用的是一个名为“user\u id”的列,该列应该位于“user”表中,但是您的user表中有一个列“id”。

正如错误中所述:“user.user\u id”列不存在。在您的关系中,您引用的是一个名为“user_id”的列,该列应该位于“user”表中,但是您的user表具有列“id”