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