updated examples
[civicrm-core.git] / api / v3 / examples / GrantDelete.php
index 92b6487a60066a8f15686af44065d8802d488ed3..a0a8d91956e9c2666ae496a832453dd778aec2b3 100644 (file)
@@ -1,27 +1,28 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using grant delete API
+ * *
  */
 function grant_delete_example(){
 $params = array(
-  'version' => 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
+*/