<?php
-
-/*
-
+/**
+ * Test Generated example of using event create API
+ * *
*/
function event_create_example(){
$params = array(
'is_monetary' => 0,
'is_active' => 1,
'is_show_location' => 0,
- 'version' => 3,
);
- $result = civicrm_api( 'event','create',$params );
+try{
+ $result = civicrm_api3('event', 'create', $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 event_create_expectedresult(){
'event_type_id' => '1',
'participant_listing_id' => '',
'is_public' => '1',
- 'start_date' => '20081021000000',
- 'end_date' => '20081023000000',
+ 'start_date' => '2013-07-29 00:00:00',
+ 'end_date' => '2013-08-04 00:00:00',
'is_online_registration' => '1',
'registration_link_text' => '',
'registration_start_date' => '20080601000000',
'is_template' => 0,
'template_title' => '',
'created_id' => '',
- 'created_date' => '20120130621222105',
+ 'created_date' => '2013-07-28 08:49:19',
'currency' => '',
'campaign_id' => '',
'is_share' => '',
),
);
- return $expectedResult ;
+ return $expectedResult;
}