X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FGrantDelete.php;h=a0a8d91956e9c2666ae496a832453dd778aec2b3;hb=b259a4ab1e349db53f15beb4c1e9808b58dba765;hp=92b6487a60066a8f15686af44065d8802d488ed3;hpb=9ec6ee45cba57b5cc659dcb836171e8041104ba0;p=civicrm-core.git diff --git a/api/v3/examples/GrantDelete.php b/api/v3/examples/GrantDelete.php index 92b6487a60..a0a8d91956 100644 --- a/api/v3/examples/GrantDelete.php +++ b/api/v3/examples/GrantDelete.php @@ -1,27 +1,28 @@ 3, - 'contact_id' => 5, - 'application_received_date' => 'now', - 'decision_date' => 'next Monday', - 'amount_total' => '500', - 'status_id' => 1, - 'rationale' => 'Just Because', - 'currency' => 'USD', - 'grant_type_id' => 1, + 'id' => 3, ); - $result = civicrm_api( 'grant','delete',$params ); +try{ + $result = civicrm_api3('grant', 'delete', $params); +} +catch (CiviCRM_API3_Exception $e) { + // handle error here + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); +} - return $result; +return $result; } -/* +/** * Function returns array of result expected from previous function */ function grant_delete_expectedresult(){ @@ -33,7 +34,7 @@ function grant_delete_expectedresult(){ 'values' => true, ); - return $expectedResult ; + return $expectedResult; } @@ -57,4 +58,4 @@ function grant_delete_expectedresult(){ * * API Standards documentation: * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards -*/ \ No newline at end of file +*/