2011-07-09 16 views
0

我有以下的schema.yml:如何加入EAV表table_method

JosJeventsVevdetail: 
    connection: doctrine 
    tableName: jos_jevents_vevdetail 
    columns: 
    evdet_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    rawdata: 
     type: string() 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 
    relations: 
    CustomField: { class: JosJeventsVevdetail, local: evdet_id, foreign: evdet_id, type: one, foreignType: many } 


JosJevCustomfield: 
    connection: doctrine 
    tableName: jos_jev_customfields 
    columns: 
    id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: true 
     autoincrement: true 
    evdet_id: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     primary: false 
     default: '0' 
     notnull: true 
     autoincrement: false 
    name: 
     type: string(255) 
     fixed: false 
     unsigned: false 
     primary: false 
     default: '' 
     notnull: true 
     autoincrement: false 
    value: 
     type: string() 
     fixed: false 
     unsigned: false 
     primary: false 
     notnull: true 
     autoincrement: false 

即在JosJeventsVevdetail中有許多與單個記錄匹配的名稱/值對。

我試圖用表的方法(和一些其他表)這樣的扁平化這樣的:

return $q-> 
    innerJoin("$rootAlias.Event e")-> 
    innerJoin("e.EventDetail ed")-> 
    innerJoin("ed.CustomField cf")-> 
    innerJoin("$rootAlias.JoomlaUser u")-> 
    innerJoin("u.Person p")-> 
    innerJoin("$rootAlias.Status s")-> 
    innerJoin("$rootAlias.RsvpType rt")-> 
    addWhere("cf.name=?",'preconExams')-> //this removed works,but query wrong 
    addSelect("$rootAlias.*, e.*, ed.*, s.*, rt.*, u.*, p.*, cf.*"); 

,但我得到一個錯誤信息「未知列名」。當我刪除cf.name ='preconExams'時,查詢運行,但jos_jev_customfields未加入查詢中。

該模式有什麼問題嗎?

回答

1

你的關係類錯在哪裏。它應該是JosJevCustomfield,你已經把JosJeventsVevdetail ;-)。 JosJeventsVevdetail沒有列name,因此錯誤。