Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace Drupal\crm;
4
5use Drupal\user\UserInterface;
6
7/**
8 * CrmCoreUserSyncRelation service.
9 */
10interface CrmUserContactSyncRelationInterface {
11
12  /**
13   * Retrieves the person ID from the user ID.
14   *
15   * @return int|null
16   *   Contact ID, if relation exists.
17   */
18  public function getContactIdFromUserId($user_id);
19
20  /**
21   * Retrieves the user ID from the person ID.
22   *
23   * @return int|null
24   *   User ID, if relation exists.
25   */
26  public function getUserIdFromContactId($contact_id);
27
28  /**
29   * Retrieves the relation ID from the user ID.
30   *
31   * @return int|null
32   *   Relation ID, if exists.
33   */
34  public function getRelationIdFromUserId($user_id);
35
36  /**
37   * Retrieves the relation ID from the person ID.
38   *
39   * @return int|null
40   *   Relation ID, if exists.
41   */
42  public function getRelationIdFromContactId($contact_id);
43
44  /**
45   * Synchronizes user and contact.
46   *
47   * @param \Drupal\user\UserInterface $account
48   *   Account to be synchronized. Programmatically created accounts can
49   *   override default behavior by setting
50   *   $account->crm_core_no_auto_sync = TRUE.
51   * @param \Drupal\crm\CrmContactInterface $person
52   *   Contact to be associated with $account.
53   *
54   * @return \Drupal\crm\ContactInterface
55   *   A contact object.
56   *
57   * @throws \Drupal\Core\Entity\EntityStorageException
58   */
59  public function relate(UserInterface $account, ?CrmContactInterface $person = NULL);
60
61}