0
我有这样的模式:未知记录属性/相关组件 “primary_keys” 的形式嵌入/ M:N的关系
JosUsers:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
name: { type: string(255), notnull: true }
username: { type: string(150), notnull: true }
email: { type: string(100), notnull: true }
password: { type: string(100), notnull: true }
usertype: { type: string(25), notnull: true }
block: { type: integer(1), notnull: true }
sendemail: { type: integer(1), notnull: false }
gid: { type: integer(1), default: '1', notnull: true }
registerdate: { type: timestamp(25), notnull: true }
lastvisitdate: { type: timestamp(25), notnull: true }
activation: { type: string(100), notnull: true }
params: { type: string(), notnull: true }
relations:
AccessControlObject: { class: JosCoreAclAro, local: id, foreign: value, foreignType: one }
JosCoreAclAro:
columns:
id: { type: integer(4),fixed: false, unsigned: false, primary: true, autoincrement: true}
section_value: { type: string(240), notnull: true }
value: {type: string(240), notnull: true }
order_value: { type: integer(4), notnull: true }
name: { type: string(255), notnull: true }
hidden: { type: integer(4), notnull: true }
relations:
Group: { class: JosCoreAclAroGroups, local: aro_id, foreign: group_id, refClass: JosCoreAclGroupsAroMap,foreignType: one }
JosCoreAclGroupsAroMap:
columns:
group_id: { type: integer(4), primary: true }
section_value: { type: string(240) }
aro_id: { type: integer(4), primary: true }
relations:
JosCoreAclAro: { class: JosCoreAclAro, local: aro_id, onDelete: CASCADE }
JosCoreAclAroGroup: { class: JosCoreAclAroGroups, local: group_id, onDelete: CASCADE }
JosCoreAclAroGroups:
columns:
id: {type: integer(4), primary: true, autoincrement: true }
parent_id: { type: integer(4), notnull: true }
name: { type: string(255), notnull: true }
lft: { type: integer(4), notnull: true }
rgt: { type: integer(4), notnull: true }
value: { type: string(255), notnull: true }
当我嵌入JosCoreAclAroForm这样
class JosUsersForm extends BaseJosUsersForm{
public function configure(){
$josCoreAclAroForm = new JosCoreAclAroForm();
$this->embedForm('josCoreAclAro', $josCoreAclAroForm);
}
}
我得到未知记录属性/ “JosCoreAclAroGroups”上的相关组件“primary_keys”
我想不通为什么会有这个函数被调用,我也不能在任何地方找到它?
这似乎是检查对象主键的原则。这是在学说框架。你有没有检查你的日志?我不知道symfony中的“embedForm”方法,你在使用1.4还是在尝试版本2? – Julien 2011-03-23 20:54:23
getPrimaryKeys在DoctrineCollection中,但是模型类JosCoreAclAroGroups不是DoctrineCollection的后代 – jdog 2011-03-23 21:18:01
我发现创建函数getPrimaryKeys(){return array('group_id','aro_id');}解决了这个问题,但我不确定是否它会正确保存。在网上评论说,RefClass可能有一个复合主键的问题? – jdog 2011-03-23 21:19:11