You are here

function social_event_an_enroll_count in Open Social 8.3

Same name and namespace in other branches
  1. 8.4 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_count()

Returns number of anonymous enrollments.

1 call to social_event_an_enroll_count()
social_event_an_enroll_views_post_render in modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module
Implements hook_views_post_render().

File

modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module, line 135
The Social event AN enroll module.

Code

function social_event_an_enroll_count($nid) {
  $query = \Drupal::database()
    ->select('event_enrollment__field_account', 'eefa');
  $query
    ->join('event_enrollment__field_event', 'eefe', 'eefa.entity_id = eefe.entity_id');
  $query
    ->condition('eefa.field_account_target_id', 0);
  $query
    ->condition('eefe.field_event_target_id', $nid);
  return (int) $query
    ->countQuery()
    ->execute()
    ->fetchField();
}