【发布时间】:2011-06-01 15:11:33
【问题描述】:
我正在尝试从 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
问题是由学说 generate-models-yaml 生成的模型是错误的 在 BaseEnduser $Product 中定义为 Doctrine_Collection
$this->hasMany('Product', array( '本地' => 'id', '外国' => 'enduser_id'));
而只是 Product 对象
我做错了什么?
关系定义为 外国类型:一 类型:一个
【问题讨论】:
标签: php doctrine models relation