You are here

public function Registration::hasIdentity in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Registration.php \Drupal\rng\Entity\Registration::hasIdentity()
  2. 3.x 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

boolean 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 133

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;
}