use Civi\API\Event\ExceptionEvent;
use Civi\API\Event\RespondEvent;
-
/**
*
* @package Civi
* @return array|int
*/
public function run($entity, $action, $params, $extra) {
- $apiRequest = array();
- $apiRequest['entity'] = \CRM_Utils_String::munge($entity);
- $apiRequest['action'] = \CRM_Utils_String::munge($action);
- $apiRequest['version'] = civicrm_get_api_version($params);
- $apiRequest['params'] = $params;
- $apiRequest['extra'] = $extra;
- $apiRequest['fields'] = NULL;
+ $apiRequest = $this->createRequest($entity, $action, $params, $extra);
try {
if (!is_array($params)) {
}
+ /**
+ * Create a formatted/normalized request object.
+ *
+ * @param string $entity
+ * @param string $action
+ * @param array $params
+ * @param mixed $extra
+ * @return array the request descriptor
+ */
+ public function createRequest($entity, $action, $params, $extra) {
+ $apiRequest = array();
+ $apiRequest['entity'] = \CRM_Utils_String::munge($entity);
+ $apiRequest['action'] = \CRM_Utils_String::munge($action);
+ $apiRequest['version'] = civicrm_get_api_version($params);
+ $apiRequest['params'] = $params;
+ $apiRequest['extra'] = $extra;
+ $apiRequest['fields'] = NULL;
+ return $apiRequest;
+ }
+
public function boot() {
require_once ('api/v3/utils.php');
require_once 'api/Exception.php';