Problem/Motivation
My test cleanup script stumbled on this. An exception is thrown when a membership is deleted after its user.
Steps to reproduce
- Delete a membership after its user.
Exception in Drupal\Tests\c4c\ExistingSite\DGOContractTest::tearDownAfterClass
Call to a member function id() on null
web/modules/contrib/ginvite/ginvite.module:209
web/modules/contrib/hux/src/HuxModuleHandler.php:114
web/modules/contrib/hux/src/HuxModuleHandler.php:100
web/core/lib/Drupal/Core/Extension/ModuleHandler.php:395
web/modules/contrib/hux/src/HuxModuleHandler.php:103
web/modules/contrib/hux/src/HuxModuleHandler.php:121
web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:215
web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:900
web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:462
web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:753
web/modules/contrib/group/group.module:465
web/modules/contrib/hux/src/HuxModuleHandler.php:114
web/modules/contrib/hux/src/HuxModuleHandler.php:100
web/core/lib/Drupal/Core/Extension/ModuleHandler.php:395
web/modules/contrib/hux/src/HuxModuleHandler.php:103
web/modules/contrib/hux/src/HuxModuleHandler.php:121
web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:217
web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:900
web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:462
web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:753
web/core/lib/Drupal/Core/Entity/EntityBase.php:362
web/modules/custom/c4c/tests/src/ExistingSite/ContentCleanup/EntityWatcher/EntityWatcher.php:48
web/modules/custom/c4c/tests/src/ExistingSite/BaseClass/C4cExistingSiteBase.php:56
vendor/bin/phpunit:122
Proposed resolution
s/$group_relationship->getEntity()->id()/$group_relationship->getEntityId()/
and avaid the anyway not necessary entity load.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork ginvite-3480202
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
geek-merlinME applies cleanly on my site and fixes the issue for me.
Comment #8
lobsterr commentedThank you for your contribution. I will tag a new release
Comment #9
geek-merlinThanks for the quick commit!
Comment #11
brooke_heaton commentedThis is also happening on 3.0.0-rc3.
Call to a member function id() on null in ginvite_group_content_delete() (line 209 of modules/contrib/ginvite/ginvite.module). call_user_func_array(Object, Array) (Line: 416)
Happy to open a new ticket if needed.
Comment #12
lobsterr commentedNo, no need to open, I will check
Comment #13
lobsterr commented@brooke_heaton, it looks like you are using not 3.0.0-rc3,
As you can see here in this ticket I fixed the issue: fix
And the right code is there, in your error you have a call of id(), but it was removed : https://git.drupalcode.org/project/ginvite/-/blob/3.0.x/ginvite.module?ref_type=heads#L209
I believe you are still on rc2. Could you checked it