2011-03-02 81 views
0

此刻,如果我这样做,它只是产生的schema.yml:您可以与Symfony(使用Doctrine)产生关系吗?

./symfony学说:内置模式

但是,这并不产生关系。

我必须手动将这些添加到schema.yml或有办法生成它们吗?如果我必须手动输入它,下次我执行doctrine:build-schema(用新表格等刷新模式)时,它们不会被覆盖吗?

这里是的schema.yml:

Companies: 
    connection: doctrine 
    tableName: companies 
    columns: 
    company_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    company_name: 
     type: string(100) 
     fixed: false 
      unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    company_logo: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    company_date_added: 
     type: timestamp(25) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
Credentials: 
    connection: doctrine 
    tableName: credentials 
    columns: 
    credential_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    credential_name: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    company_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    credential_date_added: 
     type: timestamp(25) 
     fixed: false 
     unsigned: false 
     primary: false 
     default: '0000-00-00 00:00:00' 
     notnull: true 
     autoincrement: false 
Groups: 
    connection: doctrine 
    tableName: groups 
    columns: 
    group_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    group_name: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    company_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    group_date_added: 
     type: timestamp(25) 
     fixed: false 
     unsigned: false 
     primary: false 
     default: '0000-00-00 00:00:00' 
     notnull: true 
     autoincrement: false 
GroupsCredentials: 
    connection: doctrine 
    tableName: groups_credentials 
    columns: 
    group_credential_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    group_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    credential_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    group_credential_date_added: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
Users: 
    connection: doctrine 
    tableName: users 
    columns: 
    user_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    user_username: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    user_password: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    user_email: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    company_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    user_date_added: 
     type: timestamp(25) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
UsersCredentials: 
    connection: doctrine 
    tableName: users_credentials 
    columns: 
    user_credential_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    user_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    credential_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    user_credential_date_added: 
     type: timestamp(25) 
     fixed: false 
     unsigned: false 
     primary: false 
     default: '0000-00-00 00:00:00' 
     notnull: true 
     autoincrement: false 
+0

它应该生成关系。他们在哪里失踪?在Base *文件中?或者在你的data/schema.sql文件中?你能告诉我们你的schema.yml至少有一个关系不起作用吗? – greg0ire 2011-03-02 18:16:10

+0

我更新了代码并添加了模式。当我执行'./symfony doctrine:build-schema'时,不会产生关系,除非我做错了什么。 – xil3 2011-03-02 18:57:00

+0

您确定关系在数据库中设置正确吗? './symfony doctrine:build-schema'根据数据库中的内容自动创建schema.yml文件...也许它会被某些东西绊倒。 – nselikoff 2011-03-02 19:05:00

回答

0

我结束了固定的问题。

MySQL DB中的关系没有正确设置 - 我的愚蠢的错误。

相关问题