Documentation

MockBasicEntity extends BasicEntity
in package

MockBasicEntity entity.

Tags
labelField

foo

primaryKey

identifier

since
5.77

Table of Contents

Properties

$deleter  : callable
Function to delete records. Used by `delete` action.
$getter  : callable
Function to read records. Used by `get` action.
$setter  : callable
Function to write a record. Used by `create`, `update` and `save`.

Methods

__callStatic()  : AbstractAction
Magic method to return the action object for an api.
autocomplete()  : AutocompleteAction
batchFrobnicate()  : BasicBatchAction
checkAccess()  : CheckAccessAction
create()  : BasicCreateAction
delete()  : BasicBatchAction
get()  : BasicGetAction
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.
replace()  : BasicReplaceAction
save()  : BasicSaveAction
update()  : BasicUpdateAction
getDaoName()  : CRM_Core_DAO|string|null
getEntityTitle()  : string
Overridable function to return a localized title for this entity.

Properties

$deleter

Function to delete records. Used by `delete` action.

protected static callable $deleter = [\Civi\Mock\MockEntityDataStorage::class, 'delete']

Function(array $item, BasicBatchAction $thisAction): array

This function is called once per delete. It takes a single record as the first param, and a reference to the action object as the second.

This callback should check the $idField of the item to determine which record to delete.

It should return the deleted record as an array.

$getter

Function to read records. Used by `get` action.

protected static callable $getter = [\Civi\Mock\MockEntityDataStorage::class, 'get']

Function(BasicGetAction $thisAction): array[]

This function should return an array of records, and is passed a copy of the BasicGetAction object as its first argument. The simplest implementation is for it to return every record and the BasicGetAction automatically handle sorting and filtering.

If performance is a concern, it can take advantage of some helper functions for e.g. fetching item(s) by id.

$setter

Function to write a record. Used by `create`, `update` and `save`.

protected static callable $setter = [\Civi\Mock\MockEntityDataStorage::class, 'write']

Function(array $item, BasicCreateAction|BasicSaveAction|BasicUpdateAction $thisAction): array

This function is called once per write. It takes a single record as the first param, and a reference to the action object as the second.

This callback should check the $idField of the record to determine whether the operation is a create or update.

It should return the updated record as an array.

Methods

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
inheritDoc
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