Merge pull request #3229 from eileenmcnaughton/e-notice
[civicrm-core.git] / api / v3 / examples / Participant / NestedEventGet.php
1 <?php
2 /**
3 * Test Generated example of using participant get API
4 * use nested get to get an event *
5 */
6 function participant_get_example(){
7 $params = array(
8 'id' => 1,
9 'api.event.get' => 1,
10 );
11
12 try{
13 $result = civicrm_api3('participant', 'get', $params);
14 }
15 catch (CiviCRM_API3_Exception $e) {
16 // handle error here
17 $errorMessage = $e->getMessage();
18 $errorCode = $e->getErrorCode();
19 $errorData = $e->getExtraParams();
20 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
21 }
22
23 return $result;
24 }
25
26 /**
27 * Function returns array of result expected from previous function
28 */
29 function participant_get_expectedresult(){
30
31 $expectedResult = array(
32 'is_error' => 0,
33 'version' => 3,
34 'count' => 1,
35 'id' => 1,
36 'values' => array(
37 '1' => array(
38 'contact_id' => '2',
39 'contact_type' => 'Individual',
40 'contact_sub_type' => '',
41 'sort_name' => 'Anderson, Anthony',
42 'display_name' => 'Mr. Anthony Anderson II',
43 'event_id' => '6',
44 'event_title' => 'Annual CiviCRM meet',
45 'event_start_date' => '2013-07-29 00:00:00',
46 'event_end_date' => '2013-08-04 00:00:00',
47 'participant_id' => '1',
48 'participant_fee_level' => '',
49 'participant_fee_amount' => '',
50 'participant_fee_currency' => '',
51 'event_type' => 'Conference',
52 'participant_status_id' => '2',
53 'participant_status' => 'Attended',
54 'participant_role_id' => '1',
55 'participant_register_date' => '2007-02-19 00:00:00',
56 'participant_source' => 'Wimbeldon',
57 'participant_note' => '',
58 'participant_is_pay_later' => 0,
59 'participant_is_test' => 0,
60 'participant_registered_by_id' => '',
61 'participant_discount_name' => '',
62 'participant_campaign_id' => '',
63 'id' => '1',
64 'api.event.get' => array(
65 'is_error' => 0,
66 'version' => 3,
67 'count' => 1,
68 'id' => 6,
69 'values' => array(
70 '0' => array(
71 'id' => '6',
72 'title' => 'Annual CiviCRM meet',
73 'event_title' => 'Annual CiviCRM meet',
74 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now',
75 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
76 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
77 'event_type_id' => '1',
78 'participant_listing_id' => 0,
79 'is_public' => '1',
80 'start_date' => '2013-07-29 00:00:00',
81 'event_start_date' => '2013-07-29 00:00:00',
82 'end_date' => '2013-08-04 00:00:00',
83 'event_end_date' => '2013-08-04 00:00:00',
84 'is_online_registration' => '1',
85 'registration_start_date' => '2008-06-01 00:00:00',
86 'registration_end_date' => '2008-10-15 00:00:00',
87 'max_participants' => '100',
88 'event_full_text' => 'Sorry! We are already full',
89 'is_monetary' => 0,
90 'is_map' => 0,
91 'is_active' => '1',
92 'is_show_location' => 0,
93 'default_role_id' => '1',
94 'is_email_confirm' => 0,
95 'is_pay_later' => 0,
96 'is_partial_payment' => 0,
97 'is_multiple_registrations' => 0,
98 'allow_same_participant_emails' => 0,
99 'is_template' => 0,
100 'created_date' => '2013-07-28 08:49:19',
101 'is_share' => '1',
102 ),
103 ),
104 ),
105 ),
106 ),
107 );
108
109 return $expectedResult;
110 }
111
112
113 /*
114 * This example has been generated from the API test suite. The test that created it is called
115 *
116 * testGetNestedEventGet and can be found in
117 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php
118 *
119 * You can see the outcome of the API tests at
120 * https://test.civicrm.org/job/CiviCRM-master-git/
121 *
122 * To Learn about the API read
123 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
124 *
125 * Browse the api on your own site with the api explorer
126 * http://MYSITE.ORG/path/to/civicrm/api/explorer
127 *
128 * Read more about testing here
129 * http://wiki.civicrm.org/confluence/display/CRM/Testing
130 *
131 * API Standards documentation:
132 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
133 */