<?php
-
-/*
- demonstrates high date filter
+/**
+ * Test Generated example of using pledge get API
+ * demonstrates high date filter *
*/
function pledge_get_example(){
$params = array(
- 'version' => 3,
- 'pledge_start_date_high' => '20130620090530',
+ 'pledge_start_date_high' => '20130801213843',
);
- $result = civicrm_api( 'pledge','get',$params );
+try{
+ $result = civicrm_api3('pledge', '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 pledge_get_expectedresult(){
'display_name' => 'Mr. Anthony Anderson II',
'pledge_id' => '2',
'pledge_amount' => '100.00',
- 'pledge_create_date' => '2013-06-22 00:00:00',
+ 'pledge_create_date' => '2013-08-03 00:00:00',
'pledge_status' => 'Overdue',
'pledge_total_paid' => '',
'pledge_next_pay_date' => '2012-03-02 00:00:00',
),
);
- return $expectedResult ;
+ return $expectedResult;
}