-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityActivity.php
More file actions
72 lines (63 loc) · 2.26 KB
/
Copy pathEntityActivity.php
File metadata and controls
72 lines (63 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/*
* Copyright (C) 2022 SYSTOPIA GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation in version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types = 1);
namespace Civi\Api4;
use Civi\ActivityEntity\Api4\Action\ConnectAction;
use Civi\ActivityEntity\Api4\Action\DisconnectAction;
use Civi\ActivityEntity\Api4\Action\DisconnectActivityAction;
use Civi\ActivityEntity\Api4\Action\DisconnectEntityAction;
/**
* Connect activities with other entities.
*
* The record_type_id field determines the type of connection.
* @ui_join_filters record_type_id
*
* @searchable bridge
* @see \Civi\Api4\Activity
* @package Civi\Api4
*/
final class EntityActivity extends Generic\DAOEntity {
use Generic\Traits\EntityBridge;
/**
* Connect an activity with an entity.
*/
public static function connect(bool $checkPermissions = TRUE): ConnectAction {
return (new ConnectAction(static::create()))
->setCheckPermissions($checkPermissions);
}
/**
* Disconnect an entity from an activity.
*/
public static function disconnect(bool $checkPermissions = TRUE): DisconnectAction {
return (new DisconnectAction(static::delete()))
->setCheckPermissions($checkPermissions);
}
/**
* Disconnect all entity connections with an activity.
*/
public static function disconnectActivity(bool $checkPermissions = TRUE): DisconnectActivityAction {
return (new DisconnectActivityAction(static::delete()))
->setCheckPermissions($checkPermissions);
}
/**
* Disconnect all activity connections with an entity.
*/
public static function disconnectEntity(bool $checkPermissions = TRUE): DisconnectEntityAction {
return (new DisconnectEntityAction(static::delete()))
->setCheckPermissions($checkPermissions);
}
}