我在哪裏可以學到更多的abt在yaml和數據夾具中創建數據庫標記。學說YAML數據夾具問題
我跟着一個教程,他們創建了這樣的關係:在用戶和汽車的關係下。我的qn是爲什麼在汽車中輸入'many:'。我可以用它在用戶(只是好奇)?
abt數據類型。不同的數據庫有不同的數據庫支持我認爲在MySQL(InnoDB這裏使用)整數shld是tinyint(x),bigint(x),int(x)...或字符串shld是varchar不是字符串?我在這裏用什麼不嚴格?
options:
type: INNODB
collate: utf8_general_ci
charset: utf8
User:
columns:
id:
type: integer
primary: true
autoincrement: true
name: string(300)
email: string(300)
phone: string(9)
car_id: integer
relations:
Car:
local: car_id
foreign: id
Car:
columns:
id:
type: integer
primary: true
autoincrement: true
brand: string(300)
relations:
Users:
class: User
foreign: car_id
local: id
type: many
更新1
「它是隻需要在指定的地方外鍵存在結束的關係」在我的例子,那會是什麼?他們是指FK表(汽車)還是FK專欄(用戶)?
我看不到TEXT數據類型,那是clob(Character Large OBject)? - iceangel89 0秒前[刪除此評論]
什麼是foreignAlias?還有別名嗎?
UPDATE 2
這將是升技長,我只是希望澄清一些在Doctrine YAML Schema Files docs page的代碼示例。專注於關係部 - >在//註釋
User:
columns:
username:
type: string(255)
password:
type: string(255)
contact_id:
type: integer
relations:
Contact:
class: Contact // if the table is named Contact, class will be Contact also?
local: contact_id
foreign: id
foreignAlias: User // whats alias for?
foreignType: one // one contact ... to ...
type: one // one user?
Contact:
columns:
first_name:
type: string(255)
last_name:
type: string(255)
phone:
type: string(255)
email:
type: string(255)
address:
type: string(255)
relations:
User:
class: User
local: id
foreign: contact_id
foreignAlias: Contact
foreignType: one
type: one
關於many to many example,什麼是下面的意思嗎?
attributes:
export: all
validate: true
tableName: group_table
refClass: GroupUser
關於關係類型。在你的例子中,shldn't foreignType是一個嗎?嗯...(1名用戶 - > 1輛車,1輛車 - >許多用戶)。當我指定關係時:car:foreignType:one,這是什麼意思?一個用戶? - iceangel89 1分鐘前[刪除此評論]。 +請參閱更新1 – iceangel89 2009-12-13 14:04:02
不,它不應該,因爲它是**外國** – develop7 2009-12-13 17:50:25
嗯......好的當你在這種情況下(你的代碼)說「foreignType:many」時,它是否意味着(1個用戶)許多車或(1車到)許多用戶。與foreignAlias相同,這是什麼意思?或它用於什麼? – iceangel89 2009-12-14 04:47:48