Merge pull request #17557 from ngo360/master
[civicrm-core.git] / Civi / Api4 / Entity.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
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 |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 * $Id$
18 *
19 */
20
21
22 namespace Civi\Api4;
23
24 /**
25 * Retrieves information about all Api4 entities.
26 *
27 * @see \Civi\Api4\Generic\AbstractEntity
28 *
29 * @package Civi\Api4
30 */
31 class Entity extends Generic\AbstractEntity {
32
33 /**
34 * @return Action\Entity\Get
35 */
36 public static function get() {
37 return new Action\Entity\Get('Entity', __FUNCTION__);
38 }
39
40 /**
41 * @return \Civi\Api4\Generic\BasicGetFieldsAction
42 */
43 public static function getFields() {
44 return new \Civi\Api4\Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() {
45 return [
46 [
47 'name' => 'name',
48 'description' => 'Entity name',
49 ],
50 [
51 'name' => 'description',
52 'description' => 'Description from docblock',
53 ],
54 [
55 'name' => 'comment',
56 'description' => 'Comments from docblock',
57 ],
58 [
59 'name' => 'see',
60 'data_type' => 'Array',
61 'description' => 'Any @see annotations from docblock',
62 ],
63 ];
64 });
65 }
66
67 /**
68 * @return Action\Entity\GetLinks
69 */
70 public static function getLinks() {
71 return new Action\Entity\GetLinks('Entity', __FUNCTION__);
72 }
73
74 /**
75 * @return array
76 */
77 public static function permissions() {
78 return [
79 'default' => ['access CiviCRM'],
80 ];
81 }
82
83 }