Add APIv4 and pseudoconstants for RelationshipCache
[civicrm-core.git] / Civi / Api4 / Entity.php
index 502de6a39b3d35062fc379cdbd21e700e1170928..cdb0ef6f7a89c1b868d7f9cc58ffacd5640f5aa5 100644 (file)
@@ -14,8 +14,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC https://civicrm.org/licensing
- * $Id$
- *
  */
 
 
@@ -31,30 +29,61 @@ namespace Civi\Api4;
 class Entity extends Generic\AbstractEntity {
 
   /**
+   * @param bool $checkPermissions
    * @return Action\Entity\Get
    */
-  public static function get() {
-    return new Action\Entity\Get('Entity', __FUNCTION__);
+  public static function get($checkPermissions = TRUE) {
+    return (new Action\Entity\Get('Entity', __FUNCTION__))
+      ->setCheckPermissions($checkPermissions);
   }
 
   /**
-   * @return \Civi\Api4\Generic\BasicGetFieldsAction
+   * @param bool $checkPermissions
+   * @return Generic\BasicGetFieldsAction
    */
-  public static function getFields() {
-    return new \Civi\Api4\Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() {
+  public static function getFields($checkPermissions = TRUE) {
+    return (new Generic\BasicGetFieldsAction('Entity', __FUNCTION__, function() {
       return [
-        ['name' => 'name'],
-        ['name' => 'description'],
-        ['name' => 'comment'],
+        [
+          'name' => 'name',
+          'description' => 'Entity name',
+        ],
+        [
+          'name' => 'title',
+          'description' => 'Localized title',
+        ],
+        [
+          'name' => 'description',
+          'description' => 'Description from docblock',
+        ],
+        [
+          'name' => 'comment',
+          'description' => 'Comments from docblock',
+        ],
+        [
+          'name' => 'icon',
+          'description' => 'crm-i icon class associated with this entity',
+        ],
+        [
+          'name' => 'dao',
+          'description' => 'Class name for dao-based entities',
+        ],
+        [
+          'name' => 'see',
+          'data_type' => 'Array',
+          'description' => 'Any @see annotations from docblock',
+        ],
       ];
-    });
+    }))->setCheckPermissions($checkPermissions);
   }
 
   /**
+   * @param bool $checkPermissions
    * @return Action\Entity\GetLinks
    */
-  public static function getLinks() {
-    return new Action\Entity\GetLinks('Entity', __FUNCTION__);
+  public static function getLinks($checkPermissions = TRUE) {
+    return (new Action\Entity\GetLinks('Entity', __FUNCTION__))
+      ->setCheckPermissions($checkPermissions);
   }
 
   /**