CRM-13072 Update examples
[civicrm-core.git] / api / v3 / examples / PriceSetGet.php
index dcfc7889869fc2056196d5dd0e0c2adff081c6af..8e9f32090fd534bf7d64938d6221763552411123 100644 (file)
@@ -1,20 +1,28 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using price_set get API
+ * *
  */
 function price_set_get_example(){
 $params = array(
-  'version' => 3,
   'name' => 'default_contribution_amount',
 );
 
-  $result = civicrm_api( 'price_set','get',$params );
+try{
+  $result = civicrm_api3('price_set', 'get', $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 price_set_get_expectedresult(){
@@ -38,7 +46,7 @@ function price_set_get_expectedresult(){
     ),
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }