You are here

function crm_core_user_sync_exists in CRM Core 8.2

Same name and namespace in other branches
  1. 7 modules/crm_core_user_sync/crm_core_user_sync.module \crm_core_user_sync_exists()

Checks if user->contact relation exists.

File

modules/crm_core_user_sync/crm_core_user_sync.module, line 204

Code

function crm_core_user_sync_exists($uid, $contact_id) {
  if (is_object($uid)) {
    $uid = $uid->uid;
  }
  if (is_object($contact_id)) {
    $contact_id = $contact_id->contact_id;
  }
  return \Drupal::service('entity.repository.relation')
    ->relationExists(array(
    array(
      'entity_type' => 'user',
      'entity_id' => $uid,
    ),
    array(
      'entity_type' => 'crm_core_contact',
      'entity_id' => $contact_id,
    ),
  ), 'crm_core_user_sync');
}