Merge pull request #20587 from eileenmcnaughton/rr
[civicrm-core.git] / Civi / Api4 / GroupContact.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 * 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 *
19 * @ui_join_filters status
20 *
21 * @searchable bridge
22 * @see \Civi\Api4\Group
23 * @since 5.19
24 * @package Civi\Api4
25 */
26 class GroupContact extends Generic\DAOEntity {
27 use Generic\Traits\EntityBridge;
28
29 /**
30 * @param bool $checkPermissions
31 * @return Action\GroupContact\Create
32 */
33 public static function create($checkPermissions = TRUE) {
34 return (new Action\GroupContact\Create(__CLASS__, __FUNCTION__))
35 ->setCheckPermissions($checkPermissions);
36 }
37
38 /**
39 * @param bool $checkPermissions
40 * @return Action\GroupContact\Save
41 */
42 public static function save($checkPermissions = TRUE) {
43 return (new Action\GroupContact\Save(__CLASS__, __FUNCTION__))
44 ->setCheckPermissions($checkPermissions);
45 }
46
47 /**
48 * @param bool $checkPermissions
49 * @return Action\GroupContact\Update
50 */
51 public static function update($checkPermissions = TRUE) {
52 return (new Action\GroupContact\Update(__CLASS__, __FUNCTION__))
53 ->setCheckPermissions($checkPermissions);
54 }
55
56 /**
57 * @return array
58 */
59 public static function getInfo() {
60 $info = parent::getInfo();
61 $info['bridge'] = [
62 'group_id' => ['description' => ts('Static (non-smart) group contacts')],
63 'contact_id' => ['description' => ts('Static (non-smart) group contacts')],
64 ];
65 return $info;
66 }
67
68 }