Announcement

Collapse
No announcement yet.

Appending to core entity relationships

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

  • 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: {
                
    typehasMany,
                
    entityTargetList,
                
    foreigntargets
            
    }
        ]


  • #2
    Hi

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


    Comment


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

      PHP Code:
      {
          
      "links": {
              
      targetlists: {
                  
      typehasMany,
                  
      entityTargetList,
                  
      foreigntargets
              
      }
          }

      Comment


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

        Comment


        • #5
          Sure. json is merged recursively.

          Comment


          • #6
            Amazing - I hadn't realised that!

            Comment

            Working...
            X