[英]Doctrine generate models - problem with relation type
我正在嘗試從Yaml模式生成教義模型
我有這樣的架構:
Product:
columns:
id:
type: integer(5)
primary: true
unsigned: true
autoincrement: true
activation_time:
type: datetime
notnull: true
enduser_id:
type: integer(5)
unsigned: true
notnull: true
relations:
Enduser:
foreignType: one
type: one
foreignAlias: Product
Hostid:
columns:
id:
type: integer(5)
primary: true
unsigned: true
autoincrement: true
value:
type: string(32)
fixed: true
notnull: true
Order:
columns:
id:
type: integer(5)
primary: true
autoincrement: true
unsigned: true
expire_date:
type: datetime
description:
type: clob
Enduser:
columns:
id:
type: integer(5)
primary: true
unsigned: true
autoincrement: true
hostid_id:
type: integer(5)
unsigned: true
notnull: true
order_id:
type: integer(5)
unsigned: true
notnull: true
relations:
Order:
foreignAlias: Endusers
Hostid:
foreignAlias: Endusers
問題是在BaseEnduser $ Product中將由doctrine generate-models-yaml生成的模型錯誤定義為Doctrine_Collection
$ this-> hasMany('Product',array('local'=>'id','foreign'=>'enduser_id'));
相反只是產品對象
我怎么了
關系定義為foreignType:一種類型:一種
按照一對一的示例 ,您只需為“產品”做
relations:
Enduser:
foreignType: one
其余的IMO似乎還不錯。 無需定義其他內容,因為您僅將最終用戶的參考與其產品一起存儲(以某種方式連接,而又不知道您想做什么,用戶不能擁有很多產品,反之亦然?)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.