You are here

public function Registration::hasIdentity in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/Registration.php \Drupal\rng\Entity\Registration::hasIdentity()
  2. 8 src/Entity/Registration.php \Drupal\rng\Entity\Registration::hasIdentity()

Searches registrants on this registration for an identity.

Parameters

\Drupal\Core\Entity\EntityInterface $identity: The identity to search.

Return value

bool Whether the identity is a registrant.

Overrides RegistrationInterface::hasIdentity

1 call to Registration::hasIdentity()
Registration::addIdentity in src/Entity/Registration.php
Shortcut to add a registrant entity.

File

src/Entity/Registration.php, line 224

Class

Registration
Defines the registration entity class.

Namespace

Drupal\rng\Entity

Code

public function hasIdentity(EntityInterface $identity) {
  foreach ($this->identities_unsaved as $identity_unsaved) {
    if ($identity == $identity_unsaved) {
      return TRUE;
    }
  }
  foreach ($this
    ->getRegistrants() as $registrant) {
    if ($registrant
      ->hasIdentity($identity)) {
      return TRUE;
    }
  }
  return FALSE;
}