Problem/Motivation

After updating to OS 12.4.6 groupStatistics.php causes an error:

Drupal\Core\Entity\Query\QueryException: 'plugin_id' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (Zeile 369 in /mnt/web/mafo/html/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

#0 /mnt/web/mafo/html/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php(263): Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable('', 'plugin_id', 'INNER', NULL, 'base_table', 'id', Array)
#1 /mnt/web/mafo/html/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(58): Drupal\Core\Entity\Query\Sql\Tables->addField('plugin_id', 'INNER', NULL)
#2 /mnt/web/mafo/html/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(176): Drupal\Core\Entity\Query\Sql\Condition->compile(Object(Drupal\mysql\Driver\Database\mysql\Select))
#3 /mnt/web/mafo/html/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(81): Drupal\Core\Entity\Query\Sql\Query->compile()
#4 /mnt/web/mafo/html/profiles/contrib/social/modules/social_features/social_group/src/GroupStatistics.php(89): Drupal\Core\Entity\Query\Sql\Query->execute()
#5 /mnt/web/mafo/html/profiles/contrib/social/modules/social_features/social_group/src/GroupStatistics.php(53): Drupal\social_group\GroupStatistics->count(Object(Drupal\social_group\Entity\Group), 'group_membershi...')

Proposed resolution

diff --git a/modules/social_features/social_features/social_group/src/GroupStatistics.php b/modules/social_features/social_features/social_group/src/GroupStatistics.php
index 746a7a9139..e72ccb75bd 100644
--- a/modules/social_features/social_features/social_group/src/GroupStatistics.php
+++ b/modules/social_features/social_features/social_group/src/GroupStatistics.php
@@ -50,7 +50,7 @@ public function __construct(Connection $connection, EntityTypeManagerInterface $
    *   The number of members.
    */
   public function getGroupMemberCount(GroupInterface $group) {
-    return $this->count($group, 'group_membership');
+    return $this->count($group, $group->getGroupType()->id() . '-group_membership');
   }

   /**
@@ -65,7 +65,7 @@ public function getGroupMemberCount(GroupInterface $group) {
    *   The number of nodes.
    */
   public function getGroupNodeCount(GroupInterface $group, $type) {
-    return $this->count($group, 'group_node:' . $type);
+    return $this->count($group, $group->getGroupType()->id() . '-' . 'group_node-' . $type);
   }

   /**
@@ -84,7 +84,7 @@ protected function count(GroupInterface $group, $type) {
     return $this->entityTypeManager->getStorage('group_content')->getQuery()
       ->accessCheck(FALSE)
       ->condition('gid', $group->id())
-      ->condition('plugin_id', $type)
+      ->condition('type', $type)
       ->count()
       ->execute();
   }
CommentFileSizeAuthor
#2 3489147-2-plugin-id-12.4.7.patch1.19 KBjkdaza

Comments

slowflyer created an issue. See original summary.

jkdaza’s picture

StatusFileSize
new1.19 KB

Thanks @slowflyer
This worked for me on the 12.4.7 release.

Here's a patch

ronaldtebrake’s picture

Thanks for that, I'll see if I can get someone to work on this one as well and also release that as hotfix!

ronaldtebrake’s picture

Status: Active » Reviewed & tested by the community

Thanks for the issue and patch;
Instead we reverted the changes from https://github.com/goalgorilla/open_social/pull/4177/files which shouldn't have made it in 12.4.x in the first place

This will be in the next 12.4.x release through: https://github.com/goalgorilla/open_social/pull/4223

ronaldtebrake’s picture

Status: Reviewed & tested by the community » Fixed

was released already in 12.4.x

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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