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