3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
14 * Retrieves information about all Api4 entities.
16 * @see \Civi\Api4\Generic\AbstractEntity
22 class Entity
extends Generic\AbstractEntity
{
27 public static $entityFields = [
30 'description' => 'Entity name',
34 'description' => 'Localized title (singular)',
37 'name' => 'title_plural',
38 'description' => 'Localized title (plural)',
42 'data_type' => 'Array',
43 'description' => 'Base class for this entity',
44 'pseudoconstant' => ['callback' => ['Civi\Api4\Utils\CoreUtil', 'getEntityTypes']],
47 'name' => 'description',
48 'description' => 'Description from docblock',
52 'description' => 'Comments from docblock',
56 'description' => 'crm-i icon class associated with this entity',
60 'description' => 'Class name for dao-based entities',
63 'name' => 'table_name',
64 'description' => 'Name of sql table, if applicable',
67 'name' => 'primary_key',
68 'data_type' => 'Array',
69 'description' => 'Name of unique identifier field(s) (e.g. [id])',
72 'name' => 'label_field',
73 'description' => 'Field to show when displaying a record',
77 'description' => 'Default column to sort results',
80 'name' => 'searchable',
81 'description' => 'How should this entity be presented in search UIs',
82 'pseudoconstant' => ['callback' => ['Civi\Api4\Utils\CoreUtil', 'getSearchableOptions']],
86 'data_type' => 'Array',
87 'description' => 'System paths for accessing this entity',
91 'data_type' => 'Array',
92 'description' => 'Any @see annotations from docblock',
96 'data_type' => 'String',
97 'description' => 'Version this API entity was added',
101 'data_type' => 'String',
102 'description' => 'PHP class name',
105 'name' => 'class_args',
106 'data_type' => 'Array',
107 'description' => 'Arguments needed by php action factory functions (used when multiple entities share a class, e.g. CustomValue).',
111 'data_type' => 'Array',
112 'description' => 'Connecting fields for EntityBridge types',
115 'name' => 'ui_join_filters',
116 'data_type' => 'Array',
117 'description' => 'When joining entities in the UI, which fields should be presented by default in the ON clause',
120 'name' => 'group_weights_by',
121 'data_type' => 'Array',
122 'description' => 'For sortable entities, what field groupings are used to order by weight',
127 * @param bool $checkPermissions
128 * @return Action\Entity\Get
130 public static function get($checkPermissions = TRUE) {
131 return (new Action\Entity\
Get('Entity', __FUNCTION__
))
132 ->setCheckPermissions($checkPermissions);
136 * @param bool $checkPermissions
137 * @return Generic\BasicGetFieldsAction
139 public static function getFields($checkPermissions = TRUE) {
140 return (new Generic\
BasicGetFieldsAction('Entity', __FUNCTION__
, function(Generic\BasicGetFieldsAction
$getFields) {
141 return Entity
::$entityFields;
142 }))->setCheckPermissions($checkPermissions);
146 * @param bool $checkPermissions
148 * @return Action\Entity\GetLinks
150 public static function getLinks($checkPermissions = TRUE) {
151 return (new Action\Entity\
GetLinks('Entity', __FUNCTION__
))
152 ->setCheckPermissions($checkPermissions);
158 public static function permissions() {
160 'default' => ['access CiviCRM'],