Add deprecation notice to generated examples
[civicrm-core.git] / api / v3 / examples / ActivityType / Get.php
index 1be34af90579ccee8bebcb536ed88ba416ad5d60..f914ae5b94ed8f1118ac530142e14d5d7a85bd4c 100644 (file)
@@ -1,35 +1,47 @@
 <?php
 /**
- * Test Generated example of using activity_type get API
- * *
+ * Test Generated example of using activity_type get API.
+ *
+ * @deprecated
+ * The activity_type api is deprecated. Please use the option_value api instead.
+ *
+ * @return array
+ *   API result array
  */
-function activity_type_get_example(){
-$params = array();
+function activity_type_get_example() {
+  $params = array();
 
-try{
-  $result = civicrm_api3('activity_type', '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);
-}
+  try{
+    $result = civicrm_api3('activity_type', '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 returns array of result expected from previous function.
+ *
+ * @return array
+ *   API result array
  */
-function activity_type_get_expectedresult(){
+function activity_type_get_expectedresult() {
 
   $expectedResult = array(
-  'is_error' => 0,
-  'version' => 3,
-  'count' => 45,
-  'values' => array(
+    'is_error' => 0,
+    'version' => 3,
+    'count' => 50,
+    'values' => array(
       '1' => 'Meeting',
       '2' => 'Phone Call',
       '3' => 'Email',
@@ -75,17 +87,23 @@ function activity_type_get_expectedresult(){
       '43' => 'Edit Batch',
       '44' => 'SMS delivery',
       '45' => 'Inbound SMS',
+      '46' => 'Payment',
+      '47' => 'Refund',
+      '48' => 'Change Registration',
+      '49' => 'Downloaded Invoice',
+      '50' => 'Emailed Invoice',
     ),
-);
+    'deprecated' => 'The activity_type api is deprecated. Please use the option_value api instead.',
+  );
 
   return $expectedResult;
 }
 
-
-/*
-* This example has been generated from the API test suite. The test that created it is called
-*
-* testActivityTypeGet and can be found in
+/**
+* This example has been generated from the API test suite.
+* The test that created it is called
+* testActivityTypeGet
+* and can be found in
 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
 *
 * You can see the outcome of the API tests at
@@ -95,7 +113,7 @@ function activity_type_get_expectedresult(){
 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
 *
 * Browse the api on your own site with the api explorer
-* http://MYSITE.ORG/path/to/civicrm/api/explorer
+* http://MYSITE.ORG/path/to/civicrm/api
 *
 * Read more about testing here
 * http://wiki.civicrm.org/confluence/display/CRM/Testing