3 * Test Generated example demonstrating the Participant.get API.
5 * Demonstrates use of nested get to fetch event data with participant records.
10 function participant_get_example() {
17 $result = civicrm_api3('Participant', 'get', $params);
19 catch (CiviCRM_API3_Exception
$e) {
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
26 'error_message' => $errorMessage,
27 'error_code' => $errorCode,
28 'error_data' => $errorData,
36 * Function returns array of result expected from previous function.
41 function participant_get_expectedresult() {
51 'contact_type' => 'Individual',
52 'contact_sub_type' => '',
53 'sort_name' => 'Anderson, Anthony',
54 'display_name' => 'Mr. Anthony Anderson II',
56 'event_title' => 'Annual CiviCRM meet',
57 'event_start_date' => '2013-07-29 00:00:00',
58 'event_end_date' => '2013-08-04 00:00:00',
59 'participant_id' => '1',
60 'participant_fee_level' => '',
61 'participant_fee_amount' => '',
62 'participant_fee_currency' => '',
63 'event_type' => 'Conference',
64 'participant_status_id' => '2',
65 'participant_status' => 'Attended',
66 'participant_role_id' => '1',
67 'participant_role' => 'Attendee',
68 'participant_register_date' => '2007-02-19 00:00:00',
69 'participant_source' => 'Wimbeldon',
70 'participant_note' => '',
71 'participant_is_pay_later' => 0,
72 'participant_is_test' => 0,
73 'participant_registered_by_id' => '',
74 'participant_discount_name' => '',
75 'participant_campaign_id' => '',
85 'title' => 'Annual CiviCRM meet',
86 'event_title' => 'Annual CiviCRM meet',
87 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now',
88 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
89 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
90 'event_type_id' => '1',
91 'participant_listing_id' => 0,
93 'start_date' => '2013-07-29 00:00:00',
94 'event_start_date' => '2013-07-29 00:00:00',
95 'end_date' => '2013-08-04 00:00:00',
96 'event_end_date' => '2013-08-04 00:00:00',
97 'is_online_registration' => '1',
98 'registration_start_date' => '2008-06-01 00:00:00',
99 'registration_end_date' => '2008-10-15 00:00:00',
100 'max_participants' => '100',
101 'event_full_text' => 'Sorry! We are already full',
105 'is_show_location' => 0,
106 'default_role_id' => '1',
107 'is_email_confirm' => 0,
109 'is_partial_payment' => 0,
110 'is_multiple_registrations' => 0,
111 'max_additional_participants' => 0,
112 'allow_same_participant_emails' => 0,
113 'allow_selfcancelxfer' => 0,
114 'selfcancelxfer_time' => 0,
116 'created_date' => '2013-07-28 08:49:19',
118 'is_confirm_enabled' => '1',
119 'is_billing_required' => 0,
127 return $expectedResult;
131 * This example has been generated from the API test suite.
132 * The test that created it is called "testGetNestedEventGet"
133 * and can be found at:
134 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
136 * You can see the outcome of the API tests at
137 * https://test.civicrm.org/job/CiviCRM-master-git/
139 * To Learn about the API read
140 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
142 * Browse the api on your own site with the api explorer
143 * http://MYSITE.ORG/path/to/civicrm/api
145 * Read more about testing here
146 * http://wiki.civicrm.org/confluence/display/CRM/Testing
148 * API Standards documentation:
149 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards