You are here

public static function LearningPathContent::getGroupMembershipIdsByType in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/LearningPathContent.php \Drupal\opigno_learning_path\LearningPathContent::getGroupMembershipIdsByType()

Returns Group memberships by types.

Parameters

int $gid: Group ID.

mixed $types: Array of membership types.

Return value

mixed Group membership ids.

1 call to LearningPathContent::getGroupMembershipIdsByType()
opigno_learning_path_entity_delete in ./opigno_learning_path.module
Implements hook_entity_delete().

File

src/LearningPathContent.php, line 269

Class

LearningPathContent
Class LearningPathContent.

Namespace

Drupal\opigno_learning_path

Code

public static function getGroupMembershipIdsByType($gid, $types) {
  $db_connection = \Drupal::service('database');
  $ids = $db_connection
    ->select('group_content_field_data', 'g_c_f_d')
    ->fields('g_c_f_d', [
    'entity_id',
  ])
    ->condition('gid', $gid)
    ->condition('type', $types, 'IN')
    ->execute()
    ->fetchCol();
  return $ids;
}