Merge pull request #21250 from agileware/CIVICRM-1820
[civicrm-core.git] / Civi / Api4 / RelationshipCache.php
CommitLineData
bf01b886 1<?php
bf01b886
CW
2/*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
bf01b886
CW
11namespace Civi\Api4;
12
13/**
14 * RelationshipCache - readonly table to facilitate joining and finding contacts by relationship.
15 *
c5076889 16 * @searchable secondary
bf01b886 17 * @see \Civi\Api4\Relationship
2f616560 18 * @ui_join_filters near_relation
d44cc3cb 19 * @since 5.29
bf01b886
CW
20 * @package Civi\Api4
21 */
22class RelationshipCache extends Generic\AbstractEntity {
465bc32a 23 use Generic\Traits\EntityBridge;
bf01b886
CW
24
25 /**
26 * @param bool $checkPermissions
27 * @return Generic\DAOGetAction
28 */
29 public static function get($checkPermissions = TRUE) {
9f338c09 30 return (new Generic\DAOGetAction(__CLASS__, __FUNCTION__))
bf01b886
CW
31 ->setCheckPermissions($checkPermissions);
32 }
33
34 /**
35 * @param bool $checkPermissions
36 * @return Generic\DAOGetFieldsAction
37 */
38 public static function getFields($checkPermissions = TRUE) {
9f338c09 39 return (new Generic\DAOGetFieldsAction(__CLASS__, __FUNCTION__))
bf01b886
CW
40 ->setCheckPermissions($checkPermissions);
41 }
42
27d31a0f
CW
43 /**
44 * @return array
45 */
46 public static function getInfo() {
47 $info = parent::getInfo();
7e224460 48 $info['bridge_title'] = ts('Relationship');
27d31a0f
CW
49 $info['bridge'] = [
50 'near_contact_id' => ['description' => ts('One or more contacts with a relationship to this contact')],
51 'far_contact_id' => ['description' => ts('One or more contacts with a relationship to this contact')],
52 ];
53 return $info;
54 }
55
bf01b886 56}