如何在table_method中加入eav表

时间:2011-07-09 23:55:49

标签: symfony1 doctrine entity-attribute-value

我有以下schema.yml:

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.*");

但是收到错误消息“Unknown column name”。当我删除cf.name ='preconExams'时,查询会运行,但jos_jev_customfields未在查询中加入。

架构有什么问题吗?

1 个答案:

答案 0 :(得分:1)

你的关系是什么错。它应该是JosJevCustomfield,你放JosJeventsVevdetail ;-)。 JosJeventsVevdetail没有列name,因此错误。