Appending to core entity relationships

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alasdaircr
    Active Community Member
    • Aug 2014
    • 525

    Appending to core entity relationships

    I'm creating a little extension for list management / campaign tracking. It's very simple and is just a way of recording who is linked to each list, and what was sent to each list.

    I have two entities: TargetList and Campaign.

    Is it possible for an extension to append it's own entity onto the core entity definition in order to add extra functionality like this as extensions?

    I want to have a many-to-many relationship between Contacts & TargetLists

    Like this, but valid JSON

    PHP Code:
    {
        "links": ["__APPEND__",
            targetlists: {
                type: hasMany,
                entity: TargetList,
                foreign: targets
            }
        ]
    } 
    
  • yuri
    Member
    • Mar 2014
    • 8467

    #2
    Hi

    You have confused me. Links is not an array. You don't need to append.


    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • alasdaircr
      Active Community Member
      • Aug 2014
      • 525

      #3
      Ok, so just having this will add this link to the others for contact ?

      PHP Code:
      {
          "links": {
              targetlists: {
                  type: hasMany,
                  entity: TargetList,
                  foreign: targets
              }
          }
      } 
      

      Comment

      • alasdaircr
        Active Community Member
        • Aug 2014
        • 525

        #4
        I presumed it would overwrite the existing links for Contact defined in core software. The example code above is for an extension.

        Comment

        • yuri
          Member
          • Mar 2014
          • 8467

          #5
          Sure. json is merged recursively.
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • alasdaircr
            Active Community Member
            • Aug 2014
            • 525

            #6
            Amazing - I hadn't realised that!

            Comment

            Working...