You are here

public function RegistrantsElementUtility::identityExists in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/RegistrantsElementUtility.php \Drupal\rng\RegistrantsElementUtility::identityExists()
  2. 3.x src/RegistrantsElementUtility.php \Drupal\rng\RegistrantsElementUtility::identityExists()

Determine if an identity is already used.

Parameters

\Drupal\Core\Entity\EntityInterface $identity: An identity to check.

Return value

boolean Whether the identity is already used.

1 call to RegistrantsElementUtility::identityExists()
RegistrantsElementUtility::peopleTypeOptions in src/RegistrantsElementUtility.php
Generate available people type options suitable for radios element.

File

src/RegistrantsElementUtility.php, line 296

Class

RegistrantsElementUtility

Namespace

Drupal\rng

Code

public function identityExists(EntityInterface $identity) {
  $registrants = $this
    ->getRegistrants();
  foreach ($registrants as $registrant) {
    if ($registrant
      ->getIdentity()
      ->id() == $identity
      ->id() && $registrant
      ->getIdentity()
      ->getEntityTypeId() == $identity
      ->getEntityTypeId()) {
      return TRUE;
    }
  }
  return FALSE;
}