Problem/Motivation

We needed to use the module in combination with Group 2.x (2.3.2 at this time). As far as this module is concerned, the difference between Group 2.x and 3.x is very minor: with Group 2.x in ReplicateNodeToGroup::addToGroups(), there will be no entity type "group_relationship", but "group_content" will exist.

Steps to reproduce

  • begin with a site running Group 2.x
  • install Replicate, Replicate UI, and Replicate Actions
  • update Replicate's config to allow the Group entity type to be cloned
  • attempt to replicate a Group entity
Results
  • there won't be a "Replicate" link in the tabs region
  • hacking the edit url to include /replicate results in the error
    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "group_relationship" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of     
    core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Proposed resolution

The very simple fix I arrived at was just to check the for a known group entity type using $this->entityTypeManager->hasDefinition(). Using that, we can set a variable for the module's $this->entityManager->getStorage() call to use an entity name appropriate to the running version of Group.

Risks

The main risk of this approach is supporting Group 2: if Group 3 continues to diverge in significant ways that Replicate Actions needs to adapt to, my simple-minded fix might need to be turned into a lot of other fixes or some sort of compatibility layer.

Comments

bedlam created an issue. See original summary.

bedlam’s picture

Patch attached.

ruslan piskarov’s picture

Status: Active » Reviewed & tested by the community

Thank you, @bedlam. LGTM.

ruslan piskarov’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.