updated examples
[civicrm-core.git] / api / v3 / examples / EventGet.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using event get API
4 * *
6a488035
TO
5 */
6function event_get_example(){
53ca8fd7 7$params = array(
6a488035 8 'event_title' => 'Annual CiviCRM meet',
53ca8fd7 9 'sequential' => true,
6a488035
TO
10);
11
fb32de45 12try{
13 $result = civicrm_api3('event', 'get', $params);
14}
15catch (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}
6a488035 22
fb32de45 23return $result;
6a488035
TO
24}
25
fb32de45 26/**
6a488035
TO
27 * Function returns array of result expected from previous function
28 */
29function event_get_expectedresult(){
30
53ca8fd7 31 $expectedResult = array(
6a488035
TO
32 'is_error' => 0,
33 'version' => 3,
34 'count' => 1,
35 'id' => 1,
53ca8fd7 36 'values' => array(
37 '0' => array(
6a488035
TO
38 'id' => '1',
39 'title' => 'Annual CiviCRM meet',
40 'event_title' => 'Annual CiviCRM meet',
41 'event_type_id' => '1',
42 'participant_listing_id' => 0,
43 'is_public' => '1',
9f1b81e0 44 'start_date' => '2013-07-29 00:00:00',
45 'event_start_date' => '2013-07-29 00:00:00',
6a488035
TO
46 'is_online_registration' => 0,
47 'is_monetary' => 0,
48 'is_map' => 0,
49 'is_active' => '1',
50 'is_show_location' => '1',
51 'default_role_id' => '1',
52 'is_email_confirm' => 0,
53 'is_pay_later' => 0,
54 'is_partial_payment' => 0,
55 'is_multiple_registrations' => 0,
56 'allow_same_participant_emails' => 0,
57 'is_template' => 0,
f27f2724 58 'created_date' => '2013-07-28 08:49:19',
6a488035
TO
59 'is_share' => '1',
60 ),
61 ),
62);
63
fb32de45 64 return $expectedResult;
6a488035
TO
65}
66
67
68/*
69* This example has been generated from the API test suite. The test that created it is called
70*
71* testGetEventByEventTitle and can be found in
72* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EventTest.php
73*
74* You can see the outcome of the API tests at
75* http://tests.dev.civicrm.org/trunk/results-api_v3
76*
77* To Learn about the API read
78* http://book.civicrm.org/developer/current/techniques/api/
79*
80* and review the wiki at
81* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
82*
83* Read more about testing here
84* http://wiki.civicrm.org/confluence/display/CRM/Testing
85*
86* API Standards documentation:
87* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 88*/