Commit | Line | Data |
---|---|---|
19b53e5b C |
1 | <?php |
2 | ||
380f3545 TO |
3 | /* |
4 | +--------------------------------------------------------------------+ | |
41498ac5 | 5 | | Copyright CiviCRM LLC. All rights reserved. | |
380f3545 | 6 | | | |
41498ac5 TO |
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 | | |
380f3545 TO |
10 | +--------------------------------------------------------------------+ |
11 | */ | |
12 | ||
13 | /** | |
14 | * | |
15 | * @package CRM | |
ca5cec67 | 16 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
380f3545 TO |
17 | */ |
18 | ||
19b53e5b C |
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 | * | |
e067edc0 CW |
27 | * @ui_join_filters status |
28 | * | |
c5076889 | 29 | * @searchable bridge |
0493ec47 | 30 | * @see \Civi\Api4\Group |
d44cc3cb | 31 | * @since 5.19 |
19b53e5b C |
32 | * @package Civi\Api4 |
33 | */ | |
465bc32a CW |
34 | class GroupContact extends Generic\DAOEntity { |
35 | use Generic\Traits\EntityBridge; | |
19b53e5b C |
36 | |
37 | /** | |
6764a9d3 | 38 | * @param bool $checkPermissions |
19b53e5b C |
39 | * @return Action\GroupContact\Create |
40 | */ | |
6764a9d3 CW |
41 | public static function create($checkPermissions = TRUE) { |
42 | return (new Action\GroupContact\Create(__CLASS__, __FUNCTION__)) | |
43 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
44 | } |
45 | ||
46 | /** | |
6764a9d3 | 47 | * @param bool $checkPermissions |
19b53e5b C |
48 | * @return Action\GroupContact\Save |
49 | */ | |
6764a9d3 CW |
50 | public static function save($checkPermissions = TRUE) { |
51 | return (new Action\GroupContact\Save(__CLASS__, __FUNCTION__)) | |
52 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
53 | } |
54 | ||
55 | /** | |
6764a9d3 | 56 | * @param bool $checkPermissions |
19b53e5b C |
57 | * @return Action\GroupContact\Update |
58 | */ | |
6764a9d3 CW |
59 | public static function update($checkPermissions = TRUE) { |
60 | return (new Action\GroupContact\Update(__CLASS__, __FUNCTION__)) | |
61 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
62 | } |
63 | ||
27d31a0f CW |
64 | /** |
65 | * @return array | |
66 | */ | |
67 | public static function getInfo() { | |
68 | $info = parent::getInfo(); | |
69 | $info['bridge'] = [ | |
70 | 'group_id' => ['description' => ts('Static (non-smart) group contacts')], | |
71 | 'contact_id' => ['description' => ts('Static (non-smart) group contacts')], | |
72 | ]; | |
73 | return $info; | |
74 | } | |
75 | ||
19b53e5b | 76 | } |