public static function getTrackedActivities($memberCampaignId) {
    $query = \Drupal::entityQuery('openy_campaign_memb_camp_actv')
      ->condition('member_campaign', $memberCampaignId)
      ->condition('count', '0', '>');
    $activityIds = $query->execute();

    $existingActivitiesEntities = \Drupal::service('entity_type.manager')->getStorage('openy_campaign_memb_camp_actv')->loadMultiple($activityIds);
    /** @var \Drupal\openy_campaign\Entity\MemberCampaignActivity $activity */
    $activity_count_names = [];
    foreach ($existingActivitiesEntities as $activity) {
      $name = $activity->activity->entity->get('name')->value;
      $desc = $activity->activity->entity->get('description')->value;
      // Count activities by name.
      $activity_count_names[$name]['name'] = $name;
      $activity_count_names[$name]['desc'] = $desc;
      $activity_count_names[$name]['count'] += $activity->count->value;
    }

    return $activity_count_names;
  }
public static function getTrackedActivities($memberCampaignId) {
    $query = \Drupal::entityQuery('openy_campaign_memb_camp_actv')
      ->condition('member_campaign', $memberCampaignId)
      ->condition('count', '0', '>');
    $activityIds = $query->execute();

    $existingActivitiesEntities = \Drupal::service('entity_type.manager')->getStorage('openy_campaign_memb_camp_actv')->loadMultiple($activityIds);
    /** @var \Drupal\openy_campaign\Entity\MemberCampaignActivity $activity */
    $activity_count_names = [];
    foreach ($existingActivitiesEntities as $activity) {
      $name = $activity->activity->entity->get('name')->value;
      $desc = $activity->activity->entity->get('description')->value;
      // Count activities by name.
      $activity_count_names[$name]['name'] = $name;
      $activity_count_names[$name]['desc'] = $desc;
      $activity_count_names[$name]['count'] += $activity->count->value;
    }

    return $activity_count_names;
  }
public static function getTrackedActivities ( $ memberCampaignId ) { $ query = \ Drupal :: entityQuery ( 'openy_campaign_memb_camp_actv' ) -> condition ( 'member_campaign' , $ memberCampaignId ) -> condition ( 'count' , '0' , '>' ) ; $ activityIds = $ query -> execute ( ) ; $ existingActivitiesEntities = \ Drupal :: service ( 'entity_type.manager' ) -> getStorage ( 'openy_campaign_memb_camp_actv' ) -> loadMultiple ( $ activityIds ) ; /** @var \Drupal\openy_campaign\Entity\MemberCampaignActivity $activity */ $ activity_count_names = [ ] ; foreach ( $ existingActivitiesEntities as $ activity ) { $ name = $ activity -> activity -> entity -> get ( 'name' ) -> value ; $ desc = $ activity -> activity -> entity -> get ( 'description' ) -> value ; // Count activities by name. $ activity_count_names [ $ name ] [ 'name' ] = $ name ; $ activity_count_names [ $ name ] [ 'desc' ] = $ desc ; $ activity_count_names [ $ name ] [ 'count' ] += $ activity -> count -> value ; } return $ activity_count_names ; }
Get an array of the activities tracked by user.

@param $memberCampaignId

@return array
Get an array of the activities tracked by user .