You are here

public function EventEnrollmentStatusHelper::getEventEnrollments in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/src/EventEnrollmentStatusHelper.php \Drupal\social_event\EventEnrollmentStatusHelper::getEventEnrollments()
  2. 10.3.x modules/social_features/social_event/src/EventEnrollmentStatusHelper.php \Drupal\social_event\EventEnrollmentStatusHelper::getEventEnrollments()
  3. 10.0.x modules/social_features/social_event/src/EventEnrollmentStatusHelper.php \Drupal\social_event\EventEnrollmentStatusHelper::getEventEnrollments()
  4. 10.2.x modules/social_features/social_event/src/EventEnrollmentStatusHelper.php \Drupal\social_event\EventEnrollmentStatusHelper::getEventEnrollments()

Custom check to see if a user has enrollments.

Parameters

string $user: The email or userid you want to check on.

int $event: The event id you want to check on.

bool $ignore_all_status: Default FALSE, if set to TRUE then ignore any request_or_invite status.

Return value

\Drupal\Core\Entity\EntityInterface[] Returns a specific event enrollment for a user.

File

modules/social_features/social_event/src/EventEnrollmentStatusHelper.php, line 174

Class

EventEnrollmentStatusHelper
Class EventEnrollmentStatusHelper.

Namespace

Drupal\social_event

Code

public function getEventEnrollments($user, $event, $ignore_all_status = FALSE) {
  $conditions = $this
    ->userEnrollments($user, $event);

  // If the $ignore_all_status parameter is TRUE, and we have the field
  // field_request_or_invite_status in our $conditions, unset this field.
  if ($ignore_all_status === TRUE && isset($conditions['field_request_or_invite_status'])) {
    unset($conditions['field_request_or_invite_status']);
  }
  return $this->entityTypeManager
    ->getStorage('event_enrollment')
    ->loadByProperties($conditions);
}