Announcement

Collapse
No announcement yet.

Expand query for related entities

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Expand query for related entities

    We created a new module 'texts' which keeps various entries from different authors. Such are related flexibly via parent_type and parent_id to entities account, contact and opportunity. Now the customer wants to add a second, fixed relation account_id to texts (which we did and which is filled correctly from account if present).
    But we do not find a way to expand the query for texts related to accounts so that once we display an account all related texts from parent_id OR account_id are displayed.
    Any help is appreciated
    ------------------
    Robert Laussegger
    iscon group
    http://www.iscongroup.net
    mailto://info@iscongroup.net

  • #2
    for my understanding it looks lilke you need to implement your custom/own relationship. Take a look into application/Espo/Core/Utils/Database/Orm/Relations/ to be referenced in your entityDefs

    Comment


    • #3
      The relationship is created and the foreign key is fetched and inserted correctly. No problem there. But since these two relation ids (foreign keys) might be account and opportunity or opportunity and contact I need to expand the query for e.g. accounts to include BOTH ids. Simply put: select * from texts where id_a in (select id from account) or id_b in (select id from account)
      The question was where to put the extended query
      ------------------
      Robert Laussegger
      iscon group
      http://www.iscongroup.net
      mailto://info@iscongroup.net

      Comment

      Working...
      X