ChainSubscriber
in package
implements
EventSubscriberInterface
The ChainSubscriber looks for API parameters which specify a nested or chained API call. For example:
$result = civicrm_api('Contact', 'create', array(
'version' => 3,
'first_name' => 'Amy',
'api.Email.create' => array(
'email' => 'amy@example.com',
'location_type_id' => 123,
),
));
The ChainSubscriber looks for any parameters of the form "api.Email.create"; if found, it issues the nested API call (and passes some extra context -- eg Amy's contact_id).
Table of Contents
Interfaces
- EventSubscriberInterface
Methods
- getSubscribedEvents() : array<string|int, mixed>
- onApiRespond() : mixed
- callNestedApi() : mixed
- Call any nested api calls.
Methods
getSubscribedEvents()
public
static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>onApiRespond()
public
onApiRespond(RespondEvent $event) : mixed
Parameters
- $event : RespondEvent
-
API response event.
Tags
callNestedApi()
Call any nested api calls.
protected
callNestedApi(Kernel $apiKernel, mixed &$params, mixed &$result, mixed $action, mixed $entity, mixed $version) : mixed
TODO: We don't really need this to be a separate function.
Parameters
- $apiKernel : Kernel
- $params : mixed
- $result : mixed
- $action : mixed
- $entity : mixed
- $version : mixed