abstract class AbstractEntity

Base class for all api entities.

When adding your own api from an extension, extend this class only if your entity does not have an associated DAO. Otherwise extend DAOEntity.

The recommended way to create a non-DAO-based api is to extend this class and then add a getFields function and any other actions you wish, e.g. - a get() function which returns BasicGetAction using your custom getter callback - a create() function which returns BasicCreateAction using your custom setter callback - an update() function which returns BasicUpdateAction using your custom setter callback - a delete() function which returns BasicBatchAction using your custom delete callback - a replace() function which returns BasicReplaceAction (no callback needed but depends on the existence of get, create, update & delete actions)

Note that you can use the same setter callback function for update as create - that function can distinguish between new & existing records by checking if the unique identifier has been set (identifier field defaults to "id" but you can change that when constructing BasicUpdateAction)

Methods

static GetActions
getActions()

No description

static 
getFields()

Should return \Civi\Api4\Generic\BasicGetFieldsAction

static array
permissions()

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

static string
getEntityName()

Get entity name from called class

static AbstractAction
__callStatic(string $action, null $args)

Magic method to return the action object for an api.

Details

at line 66
static GetActions getActions()

Return Value

GetActions

at line 75
static getFields()

Should return \Civi\Api4\Generic\BasicGetFieldsAction

at line 84
static array permissions()

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

Return Value

array

at line 99
static protected string getEntityName()

Get entity name from called class

Return Value

string

at line 111
static AbstractAction __callStatic(string $action, null $args)

Magic method to return the action object for an api.

Parameters

string $action
null $args

Return Value

AbstractAction

Exceptions

NotImplementedException