APIv4 - Get dynamic list of entity types
[civicrm-core.git] / Civi / Api4 / GroupContact.php
CommitLineData
19b53e5b 1<?php
380f3545
TO
2/*
3 +--------------------------------------------------------------------+
41498ac5 4 | Copyright CiviCRM LLC. All rights reserved. |
380f3545 5 | |
41498ac5
TO
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 |
380f3545
TO
9 +--------------------------------------------------------------------+
10 */
19b53e5b
C
11namespace Civi\Api4;
12
13/**
14 * GroupContact entity - link between groups and contacts.
15 *
16 * A contact can either be "Added" "Removed" or "Pending" in a group.
17 * CiviCRM only considers them to be "in" a group if their status is "Added".
18 *
e067edc0
CW
19 * @ui_join_filters status
20 *
c5076889 21 * @searchable bridge
0493ec47 22 * @see \Civi\Api4\Group
d44cc3cb 23 * @since 5.19
19b53e5b
C
24 * @package Civi\Api4
25 */
465bc32a
CW
26class GroupContact extends Generic\DAOEntity {
27 use Generic\Traits\EntityBridge;
19b53e5b
C
28
29 /**
6764a9d3 30 * @param bool $checkPermissions
19b53e5b
C
31 * @return Action\GroupContact\Create
32 */
6764a9d3
CW
33 public static function create($checkPermissions = TRUE) {
34 return (new Action\GroupContact\Create(__CLASS__, __FUNCTION__))
35 ->setCheckPermissions($checkPermissions);
19b53e5b
C
36 }
37
38 /**
6764a9d3 39 * @param bool $checkPermissions
19b53e5b
C
40 * @return Action\GroupContact\Save
41 */
6764a9d3
CW
42 public static function save($checkPermissions = TRUE) {
43 return (new Action\GroupContact\Save(__CLASS__, __FUNCTION__))
44 ->setCheckPermissions($checkPermissions);
19b53e5b
C
45 }
46
47 /**
6764a9d3 48 * @param bool $checkPermissions
19b53e5b
C
49 * @return Action\GroupContact\Update
50 */
6764a9d3
CW
51 public static function update($checkPermissions = TRUE) {
52 return (new Action\GroupContact\Update(__CLASS__, __FUNCTION__))
53 ->setCheckPermissions($checkPermissions);
19b53e5b
C
54 }
55
27d31a0f
CW
56 /**
57 * @return array
58 */
59 public static function getInfo() {
60 $info = parent::getInfo();
61 $info['bridge'] = [
63f3df59
CW
62 'group_id' => [
63 'to' => 'contact_id',
64 'description' => ts('Static (non-smart) group contacts'),
65 ],
66 'contact_id' => [
67 'to' => 'group_id',
68 'description' => ts('Static (non-smart) group contacts'),
69 ],
27d31a0f
CW
70 ];
71 return $info;
72 }
73
19b53e5b 74}