Merge pull request #18879 from colemanw/fixDAOStyle
[civicrm-core.git] / Civi / Api4 / Entity.php
CommitLineData
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
20namespace 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 */
29class 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',
9813ae79
CW
53 'description' => 'Localized title (singular)',
54 ],
55 [
56 'name' => 'title_plural',
57 'description' => 'Localized title (plural)',
60f88aac 58 ],
90908aac
CW
59 [
60 'name' => 'type',
61 'description' => 'Base class for this entity',
62 'options' => ['DAOEntity' => 'DAOEntity', 'BasicEntity' => 'BasicEntity', 'BridgeEntity' => 'BridgeEntity', 'AbstractEntity' => 'AbstractEntity'],
63 ],
f827fe49
CW
64 [
65 'name' => 'description',
66 'description' => 'Description from docblock',
67 ],
68 [
69 'name' => 'comment',
70 'description' => 'Comments from docblock',
71 ],
60f88aac
CW
72 [
73 'name' => 'icon',
74 'description' => 'crm-i icon class associated with this entity',
75 ],
76 [
77 'name' => 'dao',
78 'description' => 'Class name for dao-based entities',
79 ],
f827fe49
CW
80 [
81 'name' => 'see',
e15f9453 82 'data_type' => 'Array',
f827fe49
CW
83 'description' => 'Any @see annotations from docblock',
84 ],
19b53e5b 85 ];
6764a9d3 86 }))->setCheckPermissions($checkPermissions);
19b53e5b
C
87 }
88
89 /**
6764a9d3 90 * @param bool $checkPermissions
19b53e5b
C
91 * @return Action\Entity\GetLinks
92 */
6764a9d3
CW
93 public static function getLinks($checkPermissions = TRUE) {
94 return (new Action\Entity\GetLinks('Entity', __FUNCTION__))
95 ->setCheckPermissions($checkPermissions);
19b53e5b
C
96 }
97
98 /**
99 * @return array
100 */
101 public static function permissions() {
102 return [
103 'default' => ['access CiviCRM'],
104 ];
105 }
106
107}