AbstractEntity
in package
implements
EntityInterface
Base class for all api entities.
This is the most generic of 3 possible base classes for an APIv4 Entity
(the other 2, which extend this class, are BasicEntity
and DAOEntity
).
Implementing an API by extending this class directly is appropriate when it does not implement
all of the CRUD actions, or only a subset like get
without create
, update
or delete
;
for example the RelationshipCache entity.
For all other APIs that do implement CRUD it is recommended to use:
-
DAOEntity
for all entities with a DAO (sql table). -
BasicEntity
for all others, e.g. file-based entities.
An entity which extends this class directly must, at minimum, implement the getFields
action.
Tags
Table of Contents
Interfaces
- EntityInterface
- This is currently a null interface - it allows picking up AbstractEntities via the ClassScanner
Methods
- __callStatic() : AbstractAction
- Magic method to return the action object for an api.
- checkAccess() : CheckAccessAction
- 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.
Methods
__callStatic()
Magic method to return the action object for an api.
public
static __callStatic(string $action, array<string|int, mixed> $args) : AbstractAction
Parameters
- $action : string
- $args : array<string|int, mixed>
Tags
Return values
AbstractActioncheckAccess()
public
static checkAccess() : CheckAccessAction
Return values
CheckAccessActiongetActions()
public
static getActions([bool $checkPermissions = TRUE ]) : GetActions
Parameters
- $checkPermissions : bool = TRUE
Return values
GetActionsgetEntityName()
Get entity name from called class
public
static getEntityName() : string
Return values
stringgetFields()
public
abstract static getFields() : BasicGetFieldsAction
Return values
BasicGetFieldsActiongetInfo()
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
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}getLinks()
public
static getLinks([bool $checkPermissions = TRUE ]) : GetLinks
Parameters
- $checkPermissions : bool = TRUE
Return values
GetLinkspermissions()
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>getDaoName()
protected
static getDaoName() : CRM_Core_DAO|string|null
Return values
CRM_Core_DAO|string|nullgetEntityTitle()
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.