You are here

function social_user_export_events_enrollments_count in Open Social 8

Same name and namespace in other branches
  1. 8.2 modules/social_features/social_user_export/social_user_export.module \social_user_export_events_enrollments_count()

Returns quantity of enrollments of specific user.

Parameters

\Drupal\user\UserInterface $account: The account to get the data for.

Return value

int Quantity of enrollments by the account.

1 call to social_user_export_events_enrollments_count()
ExportUser::exportUserOperation in modules/social_features/social_user_export/src/ExportUser.php
Callback of one operation.

File

modules/social_features/social_user_export/social_user_export.module, line 161
The Social User Export module.

Code

function social_user_export_events_enrollments_count(UserInterface $account) {
  $query = \Drupal::database()
    ->select('event_enrollment', 'ee');
  $query
    ->join('event_enrollment_field_data', 'eefd', 'eefd.id = ee.id');
  $query
    ->condition('eefd.user_id', $account
    ->id());
  return (int) $query
    ->countQuery()
    ->execute()
    ->fetchField();
}