Closed (fixed)
Project:
Group
Version:
3.3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2024 at 16:32 UTC
Updated:
23 Dec 2024 at 13:44 UTC
Jump to comment: Most recent
Running the update hooks to go from Group 2.3.1 to Group 3.3.1 deliberately does not convert all group_content_type entities ID to the new format as that could cause all sorts of issues. However, the code in GroupRelationshipTypeStorage::getRelationshipTypeId() does not account for the fact that some of these entities may still be using the old ID pattern.
This leads to errors like the one below:
TypeError: field_ui_entity_operation(): Argument #1 ($entity) must be of type Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/web/modules/contrib/group/src/Plugin/Group/RelationHandlerDefault/OperationProvider.php on line 78 in field_ui_entity_operation() (line 133 of core/modules/field_ui/field_ui.module).
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 #2
pcate commentedDoing a test upgrade from v2.3.1 to v3.3.2 I ran into this same error.
Comment #3
pcate commentedAny
language.content_settings.group_content.*config files were also not updated. Some of those include the ones with hashed ID's so I'm not sure if updating the language config files needs to be part of the update hook to prevent config dependency errors.Comment #4
kristiaanvandeneyndeUpdated the fixture and can confirm, will see what I can do.
Comment #6
kristiaanvandeneyndeMR added, now I need to figure out why the IDs weren't adapted. Although I recall being against that because changing a bundle name has all sorts of extra implications. So I think the idea was to keep the old bundle names, but then the code needs to be able to deal with that.
Comment #7
kristiaanvandeneyndeOkay, so we're always going to set a group_update_10300_detected_legacy_version state key now and leverage that in GroupRelationshipTypeStorage::getRelationshipTypeId(). This means older sites will be slightly slower as we cannot be sure there what the relationship type ID is.
Will try to take care of this as neatly as I can.
Comment #8
kristiaanvandeneyndeNeeds tests for new approach, but basically we now have:
You can already try the MR out if you wish. I'll only commit it once we have tests, though.
Comment #9
kristiaanvandeneyndeUpdating IS to reflect the real problem, we may need to double-check the upgrade guide and specifically mention that old IDs are fine, even if a bit confusing.
Comment #10
kristiaanvandeneyndeRight, added tests to prove this works. Just need to check the update guide now to make sure we got all bases covered.
Comment #11
kristiaanvandeneyndeI've updated the guide here: https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib...
At this point it would be nice if anyone could confirm that the changes here improve the upgrade path, then I can commit it and tag a new release.
Comment #12
pcate commented@kristiaanvandeneynde I just ran a test upgrade from v2 to v3 with this MR and it resolved the error.
Comment #13
pcate commentedComment #15
kristiaanvandeneyndeThanks for the steps to reproduce and confirmation. Normally I don't easily assign credit for these types of comments, but given the impact I think quick responses ought to be rewarded.