Merge pull request #2288 from eileenmcnaughton/CRM-14043
[civicrm-core.git] / api / v3 / examples / UFMatchGet.php
index 852b15c6c71ac43ac45342dc703f0ee6c80d6ac1..2e664f4be6b3d93da15a7fd27420d547ff6b1962 100644 (file)
@@ -1,20 +1,28 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using uf_match get API
+ * *
  */
 function uf_match_get_example(){
 $params = array(
   'contact_id' => 69,
-  'version' => 3,
 );
 
-  $result = civicrm_api( 'uf_match','get',$params );
+try{
+  $result = civicrm_api3('uf_match', '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 uf_match_get_expectedresult(){
@@ -34,7 +42,7 @@ function uf_match_get_expectedresult(){
     ),
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }