2011-03-23 56 views
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」

我想不通爲什麼會有這個函數被調用,我也不能在任何地方找到它?

+0

這似乎是檢查對象主鍵的原則。這是在學說框架。你有沒有檢查你的日誌?我不知道symfony中的「embedForm」方法,你在使用1.4還是在嘗試版本2? – Julien 2011-03-23 20:54:23

+0

getPrimaryKeys在DoctrineCollection中,但是模型類JosCoreAclAroGroups不是DoctrineCollection的後代 – jdog 2011-03-23 21:18:01

+0

我發現創建函數getPrimaryKeys(){return array('group_id','aro_id');}解決了這個問題,但我不確定是否它會正確保存。在網上評論說,RefClass可能有一個複合主鍵的問題? – jdog 2011-03-23 21:19:11

回答

0

Greg0ire回答道:「類名應該是單數,並且由於學說根據名稱是否以s結尾而做出許多猜測,這可能是問題的根源,JosCoreAclAroGroups結尾的s可能會在某個地方被誤解了。「

相關問題