如何在table_method中加入eav表

发布于 2024-11-19 04:26:47 字数 1875 浏览 3 评论 0原文

我有以下 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.*");

但我收到一条错误消息“未知列名”。当我删除 cf.name='preconExams' 时,查询会运行,但 jos_jev_customfields 未加入查询中。

架构有什么问题吗?

I have the following 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

I.e. there are many name/value pairs that are matched with a single record in JosJeventsVevdetail.

I'm trying to flatten this with a table method ( and some other tables) like this:

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

but I get an error message "Unknown column name". When I remove cf.name='preconExams', the query runs, but jos_jev_customfields is not joined in the query.

Is there anything wrong with the schema?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩于岁月 2024-11-26 04:26:47

问题出在你的关系的类别上。它应该是 JosJevCustomfield 并且您已放置 JosJeventsVevdetail ;-) 。 JosJeventsVevdetail 没有列 name,因此出现错误。

what is wrong is the class of your relation. It shoud be JosJevCustomfield and you've put JosJeventsVevdetail ;-) . JosJeventsVevdetail has no column name, hence the error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文