You are here

public function Activity::hasParticipant in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_activity/src/Entity/Activity.php \Drupal\crm_core_activity\Entity\Activity::hasParticipant()
  2. 8.2 modules/crm_core_activity/src/Entity/Activity.php \Drupal\crm_core_activity\Entity\Activity::hasParticipant()

Check if participant exists in the activity.

Parameters

\Drupal\crm_core_contact\ContactInterface $contact: The contact to check in activity participant.

Return value

bool Returns TRUE if activity has a given contact/participant.

Overrides ActivityInterface::hasParticipant

File

modules/crm_core_activity/src/Entity/Activity.php, line 209

Class

Activity
CRM Activity Entity Class.

Namespace

Drupal\crm_core_activity\Entity

Code

public function hasParticipant(ContactInterface $contact) {
  foreach ($this->activity_participants as $participant) {
    if ($participant->target_id == $contact
      ->id()) {
      return TRUE;
    }
  }
  return FALSE;
}