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();
}