Add Relationship Function

Created on 29 August 2023, over 1 year ago

Problem/Motivation


Hi i know this is probably not the right place but I am looking for some help with the group Module. I am using the entity clone module to clone groups and i have gotten it so far that members are cloned with the group but the content is not cloned with it so i am currently trying to do that and have come across the addRelationship() function but that needs a plugin ID and that is where I am lost. I can not get the correct plugin ID. Here the function

public function myPreClone(EntityCloneEvent $event): void {
      $original = $event->getEntity();
      $newEntity = $event->getClonedEntity();
      
      $relationships = $original->getRelatedEntities();
      foreach ($relationships as $relationship) {
        
        $newEntity->save();
        $newEntity->addRelationship($relationship, $relationship->getPluginID(), $values = []);
        $newEntity->save();
      }

    }

Can someone help or tell me where i can ask for help?

Steps to reproduce

Try to programmtically add a relationship to a group.

💬 Support request
Status

Active

Version

3.1

Component

Code

Created by

🇦🇹Austria eameyers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024