Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the database we have table "group_relationship_field_data" which is the data table for group content entities. In this table, we can see the columns type, group_type and plugin_id. The pattern for the group membership type is usually <group_type>-<plugin>. The type (column) is limited to 32 characters, and for example closed_challenge-group_membership (33 characters) is just too long. Group includes a way to generate names that fit the limits imposed by Drupal core, and it does this consistently in its own code. However, this means that where a <bundle>-<plugin> concatenation would exceed the limit, it instead converts it to 'group_content_type_' . md5($preferred_id) and truncates it. This is done in GroupRelationshipTypeStorage::getRelationshipTypeId. The problem is that our code is naively looking at the concatenation and doesn't handle the "too long" case, which is handled by the group module. To solve the problem, we replaced the "type" condition in the database query with the "plugin_id" condition, because we do not need the relationship "type", which is unique per plugin_id and group_type. Since group_type is always the same per group entity (and we filter per entity), filtering by "plugin_id" instead of "type" gives the expected result.
- Loading branch information