Update API references from GroupContent* to GroupRelationship* (Using Group 2.0)

Created on 8 May 2024, 7 months ago
Updated 20 May 2024, 6 months ago

Problem/Motivation

I just updated the following as the community using Group 1.6.x needs to migrate away to 2/3 releases. I'm trying to first stage Group v2 ( https://www.drupal.org/project/group/releases/2.2.2 ) to then prepare for Group v3.

I ran the following today given the groupmenu release outlined here https://www.drupal.org/project/groupmenu/issues/3351701 🐛 Group menu compatibility with group V2 and V3 Needs review

composer require 'drupal/group:^2.2'
composer require 'drupal/groupmenu:^3.0@alpha'

Steps to reproduce

This is using PHP 8.3 and Drupal 10.2.6

Proposed resolution

The API reference mentions changes (see here: https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... ), such that Drupal\group\Entity\GroupContent is now Drupal\group\Entity\GroupRelationship.

I found the following strings in my web contrib local directory:

$ grep -rnw 'GroupContent' ./web/modules/contrib/groupmenu/

./modules/contrib/groupmenu/src/Controller/GroupMenuController.php:15: * Returns responses for 'group_menu' GroupContent routes.
./modules/contrib/groupmenu/modules/groupmenu_block/src/Plugin/Block/GroupMenuBlock.php:5:use Drupal\group\Entity\GroupContent;
./modules/contrib/groupmenu/modules/groupmenu_block/src/Plugin/Block/GroupMenuBlock.php:77:      $group_contents = GroupContent::loadByEntity($node);
./modules/contrib/groupmenu/groupmenu.module:14:use Drupal\group\Entity\GroupContent;
./modules/contrib/groupmenu/groupmenu.module:104:    $group_content_array = GroupContent::loadByEntity($node);

API changes

Unclear if this is resolvable by doing some fancy send command or if i'm grossly misunderstanding the API changes~

$ find ./modules/contrib/groupmenu/ -type f -exec sed -i 's/GroupContent/GroupRelationship/g' {} +

Guessing there will be some additional API changes to come! Thanks to the community for prioritizing groupmenu v3 :D

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024