Merge pull request #21957 from eileenmcnaughton/lang
[civicrm-core.git] / Civi / Api4 / RelationshipCache.php
1 <?php
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 */
11 namespace Civi\Api4;
12
13 /**
14 * RelationshipCache - readonly table to facilitate joining and finding contacts by relationship.
15 *
16 * @searchable secondary
17 * @see \Civi\Api4\Relationship
18 * @ui_join_filters near_relation
19 * @since 5.29
20 * @package Civi\Api4
21 */
22 class RelationshipCache extends Generic\AbstractEntity {
23 use Generic\Traits\EntityBridge;
24
25 /**
26 * @param bool $checkPermissions
27 * @return Generic\DAOGetAction
28 */
29 public static function get($checkPermissions = TRUE) {
30 return (new Generic\DAOGetAction(__CLASS__, __FUNCTION__))
31 ->setCheckPermissions($checkPermissions);
32 }
33
34 /**
35 * @param bool $checkPermissions
36 * @return Generic\DAOGetFieldsAction
37 */
38 public static function getFields($checkPermissions = TRUE) {
39 return (new Generic\DAOGetFieldsAction(__CLASS__, __FUNCTION__))
40 ->setCheckPermissions($checkPermissions);
41 }
42
43 /**
44 * @return array
45 */
46 public static function getInfo() {
47 $info = parent::getInfo();
48 $info['bridge_title'] = ts('Relationship');
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
56 }