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 | ||
19 | ||
19b53e5b C |
20 | namespace Civi\Api4; |
21 | ||
22 | /** | |
23 | * Retrieves information about all Api4 entities. | |
24 | * | |
0493ec47 CW |
25 | * @see \Civi\Api4\Generic\AbstractEntity |
26 | * | |
19b53e5b C |
27 | * @package Civi\Api4 |
28 | */ | |
29 | class Entity extends Generic\AbstractEntity { | |
30 | ||
31 | /** | |
6764a9d3 | 32 | * @param bool $checkPermissions |
19b53e5b C |
33 | * @return Action\Entity\Get |
34 | */ | |
6764a9d3 CW |
35 | public static function get($checkPermissions = TRUE) { |
36 | return (new Action\Entity\Get('Entity', __FUNCTION__)) | |
37 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
38 | } |
39 | ||
40 | /** | |
6764a9d3 CW |
41 | * @param bool $checkPermissions |
42 | * @return Generic\BasicGetFieldsAction | |
19b53e5b | 43 | */ |
6764a9d3 CW |
44 | public static function getFields($checkPermissions = TRUE) { |
45 | return (new Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() { | |
19b53e5b | 46 | return [ |
f827fe49 CW |
47 | [ |
48 | 'name' => 'name', | |
49 | 'description' => 'Entity name', | |
50 | ], | |
60f88aac CW |
51 | [ |
52 | 'name' => 'title', | |
53 | 'description' => 'Localized title', | |
54 | ], | |
90908aac CW |
55 | [ |
56 | 'name' => 'type', | |
57 | 'description' => 'Base class for this entity', | |
58 | 'options' => ['DAOEntity' => 'DAOEntity', 'BasicEntity' => 'BasicEntity', 'BridgeEntity' => 'BridgeEntity', 'AbstractEntity' => 'AbstractEntity'], | |
59 | ], | |
f827fe49 CW |
60 | [ |
61 | 'name' => 'description', | |
62 | 'description' => 'Description from docblock', | |
63 | ], | |
64 | [ | |
65 | 'name' => 'comment', | |
66 | 'description' => 'Comments from docblock', | |
67 | ], | |
60f88aac CW |
68 | [ |
69 | 'name' => 'icon', | |
70 | 'description' => 'crm-i icon class associated with this entity', | |
71 | ], | |
72 | [ | |
73 | 'name' => 'dao', | |
74 | 'description' => 'Class name for dao-based entities', | |
75 | ], | |
f827fe49 CW |
76 | [ |
77 | 'name' => 'see', | |
e15f9453 | 78 | 'data_type' => 'Array', |
f827fe49 CW |
79 | 'description' => 'Any @see annotations from docblock', |
80 | ], | |
19b53e5b | 81 | ]; |
6764a9d3 | 82 | }))->setCheckPermissions($checkPermissions); |
19b53e5b C |
83 | } |
84 | ||
85 | /** | |
6764a9d3 | 86 | * @param bool $checkPermissions |
19b53e5b C |
87 | * @return Action\Entity\GetLinks |
88 | */ | |
6764a9d3 CW |
89 | public static function getLinks($checkPermissions = TRUE) { |
90 | return (new Action\Entity\GetLinks('Entity', __FUNCTION__)) | |
91 | ->setCheckPermissions($checkPermissions); | |
19b53e5b C |
92 | } |
93 | ||
94 | /** | |
95 | * @return array | |
96 | */ | |
97 | public static function permissions() { | |
98 | return [ | |
99 | 'default' => ['access CiviCRM'], | |
100 | ]; | |
101 | } | |
102 | ||
103 | } |