After #3254311: Denormalize group_type and plugin_id for GroupContent entity and add indexes, there are a lot of places where we can optimize the code by directly querying group content rather than first retrieving the group content types. We can also introduce #3040478: GroupContentStorage exceptions unnecessary(?) and/or undocumented in 2.0.x

Let's do that here in one big swoop.

Comments

kristiaanvandeneynde created an issue. See original summary.

kristiaanvandeneynde’s picture

Status: Active » Needs review
StatusFileSize
new19.86 KB

Not touching the query access too much because we will rework that in #3204083: Rework group roles into a scoped system and adjust permission calculation

Status: Needs review » Needs work

The last submitted patch, 2: group-3258942-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new21.34 KB

Forgot to adjust a test.

kristiaanvandeneynde’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mvonfrie’s picture

Where is the change record regarding the removal of the $filters parameter of Group::getContentEntities($plugin_id, $filters) (or Group::getRelatedEntities($plugin_id, $filters) in 2.x/3.x)?

How can I rewrite my code which uses the filters? In my case the filter depends on the bundle type of the related entities, for type A I have to filter on the group owner UID, for type B on the current user UID. And there are two more filters to apply, which are more difficult to explain.

kristiaanvandeneynde’s picture

https://www.drupal.org/node/3258952

You can look into the method you were using and write a similar entity query.

hungdo’s picture

StatusFileSize
new1.55 KB

The static query with distinct option consumes alot of memory in our site since our group_relationship_field_data table is roughly 200K records.

Attaching a patch that uses GroupContentStorageInterface::loadByEntity() method instead.