Generic.php
Table of Contents
Functions
- civicrm_api3_generic_getfields() : array<string|int, mixed>
- Get information about fields for a given api request.
- civicrm_api3_generic_getfield() : array<string|int, mixed>
- Get metadata for a field
- _civicrm_api3_generic_getfield_spec() : mixed
- Get metadata for getfield action.
- civicrm_api3_generic_getcount() : int
- API return function to reformat results as count.
- civicrm_api3_generic_getsingle() : int
- API return function to reformat results as single result.
- civicrm_api3_generic_getvalue() : int
- API return function to reformat results as single value.
- _civicrm_api3_generic_getrefcount_spec() : mixed
- Get count of contact references.
- civicrm_api3_generic_getrefcount() : array<string|int, mixed>
- API to determine if a record is in-use.
- civicrm_api3_generic_replace() : int
- API wrapper for replace function.
- civicrm_api3_generic_getoptions() : array<string|int, mixed>
- API wrapper for getoptions function.
- _civicrm_api3_generic_getoptions_spec() : mixed
- Provide metadata for this generic action
- _civicrm_api3_generic_get_metadata_options() : mixed
- Get metadata.
Functions
civicrm_api3_generic_getfields()
Get information about fields for a given api request.
civicrm_api3_generic_getfields(array<string|int, mixed> $apiRequest[, bool $unique = TRUE ]) : array<string|int, mixed>
Getfields information is used for documentation, validation, default setting We first query the scheme using the $dao->fields function & then augment that information by calling the _spec functions that apply to the relevant function Note that we use 'unique' field names as described in the xml/schema files for get requests & just field name for create. This is because some get functions access multiple objects e.g. contact api accesses is_deleted from the activity table & from the contact table
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array. Keys are.
- entity: string
- action: string
- version: string
- function: callback (mixed)
- params: array, varies
- $unique : bool = TRUE
-
Determines whether to key by unique field names (only affects get-type) actions
Return values
array<string|int, mixed> —API success object
civicrm_api3_generic_getfield()
Get metadata for a field
civicrm_api3_generic_getfield(array<string|int, mixed> $apiRequest) : array<string|int, mixed>
Parameters
- $apiRequest : array<string|int, mixed>
Return values
array<string|int, mixed> —API success object
_civicrm_api3_generic_getfield_spec()
Get metadata for getfield action.
_civicrm_api3_generic_getfield_spec(array<string|int, mixed> &$params, array<string|int, mixed> $apiRequest) : mixed
Parameters
- $params : array<string|int, mixed>
- $apiRequest : array<string|int, mixed>
Tags
civicrm_api3_generic_getcount()
API return function to reformat results as count.
civicrm_api3_generic_getcount(array<string|int, mixed> $apiRequest) : int
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array. Keys are.
Tags
Return values
int —count of results
civicrm_api3_generic_getsingle()
API return function to reformat results as single result.
civicrm_api3_generic_getsingle(array<string|int, mixed> $apiRequest) : int
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array. Keys are.
Return values
int —count of results
civicrm_api3_generic_getvalue()
API return function to reformat results as single value.
civicrm_api3_generic_getvalue(array<string|int, mixed> $apiRequest) : int
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array. Keys are.
Return values
int —count of results
_civicrm_api3_generic_getrefcount_spec()
Get count of contact references.
_civicrm_api3_generic_getrefcount_spec(array<string|int, mixed> &$params, array<string|int, mixed> $apiRequest) : mixed
Parameters
- $params : array<string|int, mixed>
- $apiRequest : array<string|int, mixed>
civicrm_api3_generic_getrefcount()
API to determine if a record is in-use.
civicrm_api3_generic_getrefcount(array<string|int, mixed> $apiRequest) : array<string|int, mixed>
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array.
Tags
Return values
array<string|int, mixed> —API result (int 0 or 1)
civicrm_api3_generic_replace()
API wrapper for replace function.
civicrm_api3_generic_replace(array<string|int, mixed> $apiRequest) : int
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array. Keys are.
Return values
int —count of results
civicrm_api3_generic_getoptions()
API wrapper for getoptions function.
civicrm_api3_generic_getoptions(array<string|int, mixed> $apiRequest) : array<string|int, mixed>
Parameters
- $apiRequest : array<string|int, mixed>
-
Api request as an array.
Tags
Return values
array<string|int, mixed> —Array of results
_civicrm_api3_generic_getoptions_spec()
Provide metadata for this generic action
_civicrm_api3_generic_getoptions_spec(array<string|int, mixed> &$params, array<string|int, mixed> $apiRequest) : mixed
Parameters
- $params : array<string|int, mixed>
- $apiRequest : array<string|int, mixed>
_civicrm_api3_generic_get_metadata_options()
Get metadata.
_civicrm_api3_generic_get_metadata_options(array<string|int, mixed> &$metadata, array<string|int, mixed> $apiRequest, string $fieldname, array<string|int, mixed> $fieldSpec) : mixed
Function fills the 'options' array on the metadata returned by getfields if
- the param option 'get_options' is defined - e.g. $params['options']['get_options'] => array('custom_1) (this is passed in as the $fieldsToResolve array)
- the field is a pseudoconstant and is NOT an FK
- the reason for this is that checking / transformation is done on pseudoconstants but
- if the field is an FK then mysql will enforce the data quality (& we have handling on failure)
Parameters
- $metadata : array<string|int, mixed>
-
The array of metadata that will form the result of the getfields function.
- $apiRequest : array<string|int, mixed>
- $fieldname : string
-
Field currently being processed.
- $fieldSpec : array<string|int, mixed>
-
Metadata for that field.