/**
  * Open a new transaction instance (if appropriate in the current policy)
  *
  * @param \Civi\API\Event\PrepareEvent $event
  */
 function onApiPrepare(\Civi\API\Event\PrepareEvent $event)
 {
     $apiRequest = $event->getApiRequest();
     if ($this->isTransactional($event->getApiProvider(), $apiRequest)) {
         $this->transactions[$apiRequest['id']] = new \CRM_Core_Transaction();
     }
 }
 /**
  * @param \Civi\API\Event\PrepareEvent $event
  *   API preparation event.
  */
 public function onApiPrepare(\Civi\API\Event\PrepareEvent $event)
 {
     $apiRequest = $event->getApiRequest();
     // For input filtering, process $apiWrappers in forward order
     foreach ($this->getWrappers($apiRequest) as $apiWrapper) {
         $apiRequest = $apiWrapper->fromApiInput($apiRequest);
     }
     $event->setApiRequest($apiRequest);
 }
 /**
  * @param \Civi\API\Event\PrepareEvent $event
  *   API preparation event.
  *
  * @throws \API_Exception
  */
 public function onApiPrepare(\Civi\API\Event\PrepareEvent $event)
 {
     $apiRequest = $event->getApiRequest();
     if ($apiRequest['version'] > 3) {
         return;
     }
     $apiRequest['fields'] = _civicrm_api3_api_getfields($apiRequest);
     _civicrm_api3_swap_out_aliases($apiRequest, $apiRequest['fields']);
     if (strtolower($apiRequest['action']) != 'getfields') {
         if (empty($apiRequest['params']['id'])) {
             $apiRequest['params'] = array_merge($this->getDefaults($apiRequest['fields']), $apiRequest['params']);
         }
         // Note: If 'id' is set then verify_mandatory will only check 'version'.
         civicrm_api3_verify_mandatory($apiRequest['params'], NULL, $this->getRequired($apiRequest['fields']));
     }
     $event->setApiRequest($apiRequest);
 }
 /**
  * Open a new transaction instance (if appropriate in the current policy)
  *
  * @param \Civi\API\Event\PrepareEvent $event
  *   API preparation event.
  */
 public function onApiPrepare(\Civi\API\Event\PrepareEvent $event)
 {
     $apiRequest = $event->getApiRequest();
     if ($this->isTransactional($event->getApiProvider(), $apiRequest)) {
         $this->transactions[$apiRequest['id']] = new \CRM_Core_Transaction($this->isNested($event->getApiProvider(), $apiRequest));
     }
     if ($this->isForceRollback($event->getApiProvider(), $apiRequest)) {
         $this->transactions[$apiRequest['id']]->rollback();
     }
 }