Merge pull request #20523 from eileenmcnaughton/pcp2
[civicrm-core.git] / Civi / Api4 / GroupContact.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 */
18
19 namespace Civi\Api4;
20
21 /**
22 * GroupContact entity - link between groups and contacts.
23 *
24 * A contact can either be "Added" "Removed" or "Pending" in a group.
25 * CiviCRM only considers them to be "in" a group if their status is "Added".
26 *
27 * @ui_join_filters status
28 *
29 * @searchable bridge
30 * @see \Civi\Api4\Group
31 * @package Civi\Api4
32 */
33 class GroupContact extends Generic\DAOEntity {
34 use Generic\Traits\EntityBridge;
35
36 /**
37 * @param bool $checkPermissions
38 * @return Action\GroupContact\Create
39 */
40 public static function create($checkPermissions = TRUE) {
41 return (new Action\GroupContact\Create(__CLASS__, __FUNCTION__))
42 ->setCheckPermissions($checkPermissions);
43 }
44
45 /**
46 * @param bool $checkPermissions
47 * @return Action\GroupContact\Save
48 */
49 public static function save($checkPermissions = TRUE) {
50 return (new Action\GroupContact\Save(__CLASS__, __FUNCTION__))
51 ->setCheckPermissions($checkPermissions);
52 }
53
54 /**
55 * @param bool $checkPermissions
56 * @return Action\GroupContact\Update
57 */
58 public static function update($checkPermissions = TRUE) {
59 return (new Action\GroupContact\Update(__CLASS__, __FUNCTION__))
60 ->setCheckPermissions($checkPermissions);
61 }
62
63 /**
64 * @return array
65 */
66 public static function getInfo() {
67 $info = parent::getInfo();
68 $info['bridge'] = [
69 'group_id' => ['description' => ts('Static (non-smart) group contacts')],
70 'contact_id' => ['description' => ts('Static (non-smart) group contacts')],
71 ];
72 return $info;
73 }
74
75 }