Call to a member function getType()/getPluginID() on null

Created on 31 January 2024, 11 months ago
Updated 21 March 2024, 9 months ago

Problem/Motivation

drush updb or drush deploy errors out with

[error]  Call to a member function getType() on null                                 
[error]  Update failed: group2to3_update_9001                                        
[error]  Update aborted by: group2to3_update_9001 

The backtrace includes Drupal\group\Entity\Storage\GroupRelationshipStorage->getEntityClass('group_content_t...') ,
Drupal\Core\Entity\EntityFieldManager->buildBundleFieldDefinitions('group_content', 'group_content_t...', Array), and references to Views initiating these calls

Steps to reproduce

  1. composer require drupal/group2to3
  2. drush en group2to3
  3. composer require drupal/group:^3.0. The README should say "replace" at step 4 (as a command for the user), not "replaces" (implying that the module will do this)
  4. drush updb or drush deploy

Proposed resolution

There still seem to be many references to "group_content" in my config files, including within Views-related ones. Perhaps these need to be addressed as well? I take it from the backtrace that Views is asking the GroupRelationshipStorage class to retrieve the v2 plugin.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States msypes

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

Comments & Activities

  • Issue created by @msypes
  • πŸ‡¨πŸ‡±Chile mnico Santiago, Chile

    I saw this error 1 week ago and made this commit https://git.drupalcode.org/project/group2to3/-/commit/20b26a04093d1cef94...

    Do you have the latest version of this module?

  • πŸ‡ΊπŸ‡ΈUnited States msypes

    I guess not. Composer reported it pulled down dev-3.x d0dd2af

  • πŸ‡ΊπŸ‡ΈUnited States msypes

    Started over with

    1. composer require"drupal/group2to3:3.0.x" Composer reports Installing drupal/group2to3 (dev-3.0.x bc7f887), which includes the change in the commit you recommended
    2. drush en group2to3
    3. composer require drupal/group:^3.0
    4. drush deploy

    After completing Step 4 of 8 (Updates the target type of Entity Reference fields): Process finished., I get a new, but similar error: Call to a member function getPluginId() on null , and the backtrace still indicating Views as a source:

    • Error: Call to a member function getPluginId() on null in Drupal\group\Entity\Storage\GroupRelationshipStorage->getEntityClass() (line 93 of .../group/src/Entity/Storage/GroupRelationshipStorage.php)
    • #0 .../core/lib/Drupal/Core/Entity/EntityFieldManager.php(384): Drupal\group\Entity\Storage\GroupRelationshipStorage>getEntityClass('group_content_t...')
    • #1 .../core/lib/Drupal/Core/Entity/EntityFieldManager.php(353): Drupal\Core\Entity\EntityFieldManager->buildBundleFieldDefinitions('group_content', 'group_content_t...', Array)
    • #2 .../core/modules/views/views.views.inc(263): Drupal\Core\Entity\EntityFieldManager->getFi
      eldDefinitions('group_content', 'group_content_t...')
  • πŸ‡ΊπŸ‡ΈUnited States msypes
  • πŸ‡ΊπŸ‡ΈUnited States TechNikh

    The patch at https://www.drupal.org/project/group/issues/3399452 πŸ› Error: Call to a member function getPluginId() on null in modules/contrib/group/src/Entity/Storage/GroupRelationshipStorage.php on line 93 Active worked for me.
    https://www.drupal.org/files/issues/2023-11-06/group3-3399452-4.patch β†’

    > >  [notice] Step 2 of 8 (Copy data): Copied data. Processed to save the new configurations.
    > >  [notice] Step 3 of 8 (Replace new bundle in group relationship table): Replacement completed
    > >  [notice] Step 4 of 8 (Updates the target type of Entity Reference fields): Process finished.
    > >  [notice] Step 5 of 8 (Remove old configurations): Process finished.
    > >  [notice] Step 6 of 8 (Update entity definition installed): Process finished.
    > >  [notice] Step 7 of 8 (Update views configuration): Process finished.
    > >  [notice] Step 8 of 8 (Final Step): Congratulations, you upgraded the module Group!. Now you can uninstall this module.
    > >  [notice] Update completed: group2to3_update_9001
    >  [success] Finished performing updates.
     [success] Config import start.
    

Production build 0.71.5 2024