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
它應該生成關係。他們在哪裏失蹤?在Base *文件中?或者在你的data/schema.sql文件中?你能告訴我們你的schema.yml至少有一個關係不起作用嗎? – greg0ire 2011-03-02 18:16:10
我更新了代碼並添加了模式。當我執行'./symfony doctrine:build-schema'時,不會產生關係,除非我做錯了什麼。 – xil3 2011-03-02 18:57:00
您確定關係在數據庫中設置正確嗎? './symfony doctrine:build-schema'根據數據庫中的內容自動創建schema.yml文件...也許它會被某些東西絆倒。 – nselikoff 2011-03-02 19:05:00