Group error createAccess() must implement interface Drupal\group\Entity\GroupInterface, null given

Created on 8 November 2022, about 2 years ago
Updated 24 January 2023, almost 2 years ago

Problem/Motivation

The latest version does not work with Group module. The version 8.x-1.0-beta6 works, but the version 8.x-1.0-beta7 doesn't work.

The error is shown in normal use of a group, without using the clone function.

Steps to reproduce

A group doesn't work for the following cases:

  • edit a group member
  • add existing content

I obtain the following error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\group\Plugin\GroupContentEnablerBase::createAccess() must implement interface Drupal\group\Entity\GroupInterface, null given, called in /var/www/html/web/modules/contrib/group/src/Entity/Access/GroupContentAccessControlHandler.php on line 31 in Drupal\group\Plugin\GroupContentEnablerBase->createAccess() (line 297 of modules/contrib/group/src/Plugin/GroupContentEnablerBase.php).
Drupal\group\Plugin\GroupContentEnablerBase->createAccess(NULL, Object) (Line: 31)
Drupal\group\Entity\Access\GroupContentAccessControlHandler->checkCreateAccess(Object, Array, 'group_content_type_37d5960c330ec') (Line: 260)
Drupal\Core\Entity\EntityAccessControlHandler->createAccess('group_content_type_37d5960c330ec', Object, Array, 1) (Line: 170)
entity_clone_entity_access(Object, 'clone', Object)
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'entity_clone') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_access', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_access', Array) (Line: 96)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'clone', Object, 1) (Line: 710)
Drupal\Core\Entity\ContentEntityBase->access('clone', Object, 1) (Line: 68)
Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object)
call_user_func_array(Array, Array) (Line: 160)

Could you find a solution? Thanks

🐛 Bug report
Status

Needs review

Component

Code

Created by

🇮🇹Italy marco.aresu Cagliari

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇦Ukraine HitchShock Ukraine

    @mindaugasd It's a big question which task is duplicate. The current one was created before 🐛 Entity clone invokes any entity type's createAccess() without knowing about required context values Active

    For me, patch #4 works well to fix the issue quickly (as the temporary solution)
    But it would be great to provide support for Group modules in this case, since the modules worked for Group before and don't work now.
    Gave an example of the fix. Feel free to update it.

  • 🇲🇩Moldova sdstyles

    Additionally, provide the correct context for group_relationship.

  • 🇺🇸United States ultimike Florida, USA

    Understanding that this is probably just a temporary solution, #7 does fix the conflict caused with the Group module when trying to view/edit/remove member relationships.

    -mike

  • Status changed to RTBC about 2 months ago
  • 🇨🇦Canada mandclu

    After installing the Group module I got the fatal error described here. The patch in #7 worked for me to resolve it.

    It's worth mentioning that there is a separate project called Group Clone specifically for cloning groups, so maybe this project doesn't need to tackle the more complicated work of cloning a group with all its referenced entities.

    Moving to RTBC in the hopes that a fatal error can be avoided for sites that end up using Entity Clone and Group together.

Production build 0.71.5 2024