Group module - Error: Class Drupal\group\Entity\GroupContent not found

Created on 4 April 2023, over 1 year ago
Updated 19 January 2024, 11 months ago

Problem/Motivation

Having Quick Node Clone and Group module enabled, I get the following WSOD error on any page:

Error: Class "Drupal\group\Entity\GroupContent" not found in _quick_node_clone_has_clone_permission() (Line 87 in /web/modules/contrib/quick_node_clone/quick_node_clone.module)

#0 /web/modules/contrib/quick_node_clone/src/Controller/QuickNodeCloneNodeAccess.php(29): _quick_node_clone_has_clone_permission()

This is an issue for anyone using a recommended stable release of Group module.

Steps to reproduce

  1. Install and configure the "Group" module >=2.0
  2. Install and configure Quick Node Clone 8.x-1.x
  3. Visit manage content at /admin/content or view any node - e.g., front page

Proposed resolution

Fix references to any deprecated class removed by Group 2.0 or Group 3.0.

Consider deprecating support for older versions of Group that are no longer recommended by the maintainer.

Remaining tasks

Consider implementing hook_requirements() to warn users who have Group 1.0 that support will be (or has been) deprecated.

Update release notes if Group 1.0 support is deprecated.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica

    Okay I think I finally found the reason:

    Quick node clone uses:

    if (\Drupal::moduleHandler()->moduleExists('gnode')) {
          $group_contents = GroupContent::loadByEntity($node);
         [...]
    

    in the module file.

    The use statement:

    use Drupal\group\Entity\GroupContent;
    

    exists, but Group 3.x doesn't seem to have the Drupal\group\Entity\GroupContent class anymore!

    So this needs an update. I see the following options:
    a) Put "Quick Node Clone Group" into a submodule and define concrete version dependencies there
    b) Add an if statement to check, if the class exists and thereby change the implementation
    c) ...?

  • Assigned to lpeidro
  • 🇪🇸Spain lpeidro Madrid

    I try to create a patch that fix the incompatibility with Group v2 and v3.

  • Status changed to Needs review over 1 year ago
  • 🇪🇸Spain lpeidro Madrid

    I have push a possible solution where check when is necessary the version of module Group, and depending on the version a certain piece of code is execute with a control structure.

    There is a new class, with static methods as helper.

    The code has been pushed to the branch "8.x-1.x" of this force, I am not sure if it is ok use that branch.

    I upload a patch file to apply the fix to text.

    Thanks.

  • 🇪🇸Spain lpeidro Madrid

    I do not know why but the test system has problems to apply the patch. I local and in our CI works and the error "fatal: git apply: bad git-diff - expected /dev/null on line 135" has no sense, so int he line 135 "dev/null" is.

    I will try to fix it.

  • 🇪🇸Spain lpeidro Madrid

    I upload a new version of the patch, only with format change.

  • Issue was unassigned.
  • i got the same error and the quick-node-clone-3352168-groups-v2.patch above fixed my error, thank you so much! i'm using Quick Node Clone 8.x-1.16 and Drupal 9.5.9

  • 🇬🇧United Kingdom sergiur London, UK

    we're experiencing the same issue, the patch in #6 fixes it. thank you!

  • 🇦🇺Australia chOP

    This is a problem for anyone using Group v2.x or Group v3.x

    Group v1.x is no longer recommended.

    An upgrade path exists from Group v1.x to Group v2.x.

    New sites will often install Group v3.x.

    Consider removing Group v1.x support entirely.

    You're in a sticky situation by having this integration code but no real way to tie it to a specific version of Group. The idea of moving this integration code out into a submodule with defined dependencies and version constraints makes some sense. The current implementation uses a common method from before we had Composer support in Drupal. I understand why it was done this way, but it might be done differently now.

  • 🇬🇧United Kingdom mjmorley

    This is a duplicate of https://www.drupal.org/project/quick_node_clone/issues/3306677 Intercompatibility with Group module new versions Needs work .
    Patch #5 from that issue fixes the problem and I think is a nicer solution than the one here in this issue. I think there needs to be some discussion about which approach is better and to close the relevant ticket.

  • Status changed to Closed: duplicate 11 months ago
  • I think this question should be closed as a duplicate in order to concentrate all efforts on one thing.

    • In issue #3306677 Intercompatibility with Group module new versions Needs work , all patches are already posted as merge requests, allowing for automated testing.
    • In the same patch I see the use of the extension.list.module service to determine the version of the group module, but this service is still considered internal and it may change ( #2940481 ).
Production build 0.71.5 2024