updated examples
[civicrm-core.git] / api / v3 / examples / GroupNestingDelete.php
index 6fe5997088b5304777fb1d592b0fe9bd3a102cea..4663f2eaebb191ad03d0ea89b5d70626603042cc 100644 (file)
@@ -1,20 +1,28 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using group_nesting delete API
+ * *
  */
 function group_nesting_delete_example(){
 $params = array(
-  'version' => 3,
   'id' => 1,
 );
 
-  $result = civicrm_api( 'group_nesting','delete',$params );
+try{
+  $result = civicrm_api3('group_nesting', '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 group_nesting_delete_expectedresult(){
@@ -26,7 +34,7 @@ function group_nesting_delete_expectedresult(){
   'values' => 1,
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }
 
 
@@ -50,4 +58,4 @@ function group_nesting_delete_expectedresult(){
 *
 * API Standards documentation:
 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
-*/
\ No newline at end of file
+*/