You are here

CrmCoreUserSyncRelationInterface.php in CRM Core 8.3

Same filename and directory in other branches
  1. 8 modules/crm_core_user_sync/src/CrmCoreUserSyncRelationInterface.php

File

modules/crm_core_user_sync/src/CrmCoreUserSyncRelationInterface.php
View source
<?php

namespace Drupal\crm_core_user_sync;

use Drupal\crm_core_contact\IndividualInterface;
use Drupal\user\UserInterface;

/**
 * CrmCoreUserSyncRelation service.
 */
interface CrmCoreUserSyncRelationInterface {

  /**
   * Retrieves the individual ID from the user ID.
   *
   * @return int|null
   *   Individual ID, if relation exists.
   */
  public function getIndividualIdFromUserId($user_id);

  /**
   * Retrieves the user ID from the individual ID.
   *
   * @return int|null
   *   User ID, if relation exists.
   */
  public function getUserIdFromIndividualId($individual_id);

  /**
   * Retrieves the relation ID from the user ID.
   *
   * @return int|null
   *   Relation ID, if exists.
   */
  public function getRelationIdFromUserId($user_id);

  /**
   * Retrieves the relation ID from the individual ID.
   *
   * @return int|null
   *   Relation ID, if exists.
   */
  public function getRelationIdFromIndividualId($individual_id);

  /**
   * Synchronizes user and contact.
   *
   * @param \Drupal\user\UserInterface $account
   *   Account to be synchronized. Programmatically created accounts can
   *   override default behavior by setting
   *   $account->crm_core_no_auto_sync = TRUE.
   * @param \Drupal\crm_core_contact\IndividualInterface $individual
   *   Contact to be associated with $account.
   *
   * @return \Drupal\crm_core_contact\ContactInterface
   *   A contact object.
   *
   * @throws \Drupal\Core\Entity\EntityStorageException
   */
  public function relate(UserInterface $account, IndividualInterface $individual = NULL);

}

Interfaces

Namesort descending Description
CrmCoreUserSyncRelationInterface CrmCoreUserSyncRelation service.