Documentation

Entity extends AbstractEntity
in package

Retrieves information about all Api4 entities.

Tags
see
AbstractEntity
primaryKey

name

labelField

title_plural

searchable

none

since
5.19

Table of Contents

Properties

$entityFields  : array<string|int, array<string|int, mixed>>

Methods

__callStatic()  : AbstractAction
Magic method to return the action object for an api.
autocomplete()  : AutocompleteAction
checkAccess()  : CheckAccessAction
get()  : Get
getActions()  : GetActions
getEntityName()  : string
Get entity name from called class
getFields()  : BasicGetFieldsAction
getInfo()  : array{name: string, title: string, description: string, title_plural: string, type: string, paths: array, class: string, primary_key: array, searchable: string, dao: string, label_field: string, icon: string}
Reflection function called by Entity::get()
getLinks()  : GetLinks
permissions()  : array<string|int, mixed>
Returns a list of permissions needed to access the various actions in this api.
getDaoName()  : CRM_Core_DAO|string|null
getEntityTitle()  : string
Overridable function to return a localized title for this entity.

Properties

$entityFields

public static array<string|int, array<string|int, mixed>> $entityFields = [['name' => 'name', 'description' => 'Entity name'], ['name' => 'title', 'description' => 'Localized title (singular)'], ['name' => 'title_plural', 'description' => 'Localized title (plural)'], ['name' => 'type', 'data_type' => 'Array', 'description' => 'Base class for this entity', 'pseudoconstant' => ['callback' => ['Civi\Api4\Utils\CoreUtil', 'getEntityTypes']]], ['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' => 'table_name', 'description' => 'Name of sql table, if applicable'], ['name' => 'primary_key', 'data_type' => 'Array', 'description' => 'Name of unique identifier field(s) (e.g. [id])'], ['name' => 'label_field', 'description' => 'Field to show when displaying a record'], ['name' => 'search_fields', 'data_type' => 'Array', 'description' => 'Fields to show in search context'], ['name' => 'icon_field', 'data_type' => 'Array', 'description' => 'Field(s) which contain the icon for a record, listed in order of precedence'], ['name' => 'order_by', 'description' => 'Default column to sort results'], ['name' => 'parent_field', 'description' => 'Field linking a hierarchical entity to its parent'], ['name' => 'searchable', 'description' => 'How should this entity be presented in search UIs', 'pseudoconstant' => ['callback' => ['Civi\Api4\Utils\CoreUtil', 'getSearchableOptions']]], ['name' => 'paths', 'data_type' => 'Array', 'description' => 'System paths for accessing this entity'], ['name' => 'see', 'data_type' => 'Array', 'description' => 'Any @see annotations from docblock'], ['name' => 'since', 'data_type' => 'String', 'description' => 'Version this API entity was added'], ['name' => 'class', 'data_type' => 'String', 'description' => 'PHP class name'], ['name' => 'class_args', 'data_type' => 'Array', 'description' => 'Arguments needed by php action factory functions (used when multiple entities share a class, e.g. CustomValue).'], ['name' => 'where', 'data_type' => 'Array', 'description' => 'Constant values which will be force-set when reading/writing this entity (e.g. [contact_type => Individual])'], ['name' => 'bridge', 'data_type' => 'Array', 'description' => 'Connecting fields for EntityBridge types'], ['name' => 'ui_join_filters', 'data_type' => 'Array', 'description' => 'When joining entities in the UI, which fields should be presented by default in the ON clause'], ['name' => 'match_fields', 'data_type' => 'Array', 'description' => 'Combination of fields used for unique matching'], ['name' => 'group_weights_by', 'data_type' => 'Array', 'description' => 'For sortable entities, what field groupings are used to order by weight']]

Methods

get()

public static get([bool $checkPermissions = TRUE ]) : Get
Parameters
$checkPermissions : bool = TRUE
Return values
Get

getEntityName()

Get entity name from called class

public static getEntityName() : string
Return values
string

getInfo()

Reflection function called by Entity::get()

public static getInfo() : array{name: string, title: string, description: string, title_plural: string, type: string, paths: array, class: string, primary_key: array, searchable: string, dao: string, label_field: string, icon: string}
Tags
see
Get
Return values
array{name: string, title: string, description: string, title_plural: string, type: string, paths: array, class: string, primary_key: array, searchable: string, dao: string, label_field: string, icon: string}
public static getLinks([bool $checkPermissions = TRUE ]) : GetLinks
Parameters
$checkPermissions : bool = TRUE
Return values
GetLinks

permissions()

Returns a list of permissions needed to access the various actions in this api.

public static permissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntityTitle()

Overridable function to return a localized title for this entity.

protected static getEntityTitle([bool $plural = FALSE ]) : string
Parameters
$plural : bool = FALSE

Whether to return a plural title.

Return values
string

        
On this page

Search results