Merge pull request #20434 from colemanw/groupContact
[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 * @see \Civi\Api4\Group
30 * @package Civi\Api4
31 */
32 class GroupContact extends Generic\DAOEntity {
33 use Generic\Traits\EntityBridge;
34
35 /**
36 * @param bool $checkPermissions
37 * @return Action\GroupContact\Create
38 */
39 public static function create($checkPermissions = TRUE) {
40 return (new Action\GroupContact\Create(__CLASS__, __FUNCTION__))
41 ->setCheckPermissions($checkPermissions);
42 }
43
44 /**
45 * @param bool $checkPermissions
46 * @return Action\GroupContact\Save
47 */
48 public static function save($checkPermissions = TRUE) {
49 return (new Action\GroupContact\Save(__CLASS__, __FUNCTION__))
50 ->setCheckPermissions($checkPermissions);
51 }
52
53 /**
54 * @param bool $checkPermissions
55 * @return Action\GroupContact\Update
56 */
57 public static function update($checkPermissions = TRUE) {
58 return (new Action\GroupContact\Update(__CLASS__, __FUNCTION__))
59 ->setCheckPermissions($checkPermissions);
60 }
61
62 /**
63 * @return array
64 */
65 public static function getInfo() {
66 $info = parent::getInfo();
67 $info['bridge'] = [
68 'group_id' => ['description' => ts('Static (non-smart) group contacts')],
69 'contact_id' => ['description' => ts('Static (non-smart) group contacts')],
70 ];
71 return $info;
72 }
73
74 }