infra updated incorrectly set public functions to private on payment classes
[civicrm-core.git] / api / v3 / examples / RelationshipType / Create.php
1 <?php
2 /**
3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6 */
7
8 /**
9 * Test Generated example of using relationship_type create API.
10 *
11 *
12 * @return array
13 * API result array
14 */
15 function relationship_type_create_example() {
16 $params = array(
17 'name_a_b' => 'Relation 1 for relationship type create',
18 'name_b_a' => 'Relation 2 for relationship type create',
19 'contact_type_a' => 'Individual',
20 'contact_type_b' => 'Organization',
21 'is_reserved' => 1,
22 'is_active' => 1,
23 'sequential' => 1,
24 );
25
26 try{
27 $result = civicrm_api3('relationship_type', 'create', $params);
28 }
29 catch (CiviCRM_API3_Exception $e) {
30 // Handle error here.
31 $errorMessage = $e->getMessage();
32 $errorCode = $e->getErrorCode();
33 $errorData = $e->getExtraParams();
34 return array(
35 'error' => $errorMessage,
36 'error_code' => $errorCode,
37 'error_data' => $errorData,
38 );
39 }
40
41 return $result;
42 }
43
44 /**
45 * Function returns array of result expected from previous function.
46 *
47 * @return array
48 * API result array
49 */
50 function relationship_type_create_expectedresult() {
51
52 $expectedResult = array(
53 'is_error' => 0,
54 'version' => 3,
55 'count' => 1,
56 'id' => 1,
57 'values' => array(
58 '0' => array(
59 'id' => '1',
60 'name_a_b' => 'Relation 1 for relationship type create',
61 'label_a_b' => 'Relation 1 for relationship type create',
62 'name_b_a' => 'Relation 2 for relationship type create',
63 'label_b_a' => 'Relation 2 for relationship type create',
64 'description' => '',
65 'contact_type_a' => 'Individual',
66 'contact_type_b' => 'Organization',
67 'contact_sub_type_a' => '',
68 'contact_sub_type_b' => '',
69 'is_reserved' => '1',
70 'is_active' => '1',
71 ),
72 ),
73 );
74
75 return $expectedResult;
76 }
77
78 /**
79 * This example has been generated from the API test suite.
80 * The test that created it is called
81 * testRelationshipTypeCreate
82 * and can be found in
83 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php
84 *
85 * You can see the outcome of the API tests at
86 * https://test.civicrm.org/job/CiviCRM-master-git/
87 *
88 * To Learn about the API read
89 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
90 *
91 * Browse the api on your own site with the api explorer
92 * http://MYSITE.ORG/path/to/civicrm/api/explorer
93 *
94 * Read more about testing here
95 * http://wiki.civicrm.org/confluence/display/CRM/Testing
96 *
97 * API Standards documentation:
98 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
99 */