Merge pull request #583 from yashodha/CRM-12463
[civicrm-core.git] / api / v3 / examples / RelationshipGet.php
1 <?php
2
3 /*
4
5 */
6 function relationship_get_example(){
7 $params = array(
8 'version' => 3,
9 'id' => 1,
10 );
11
12 $result = civicrm_api( 'relationship','get',$params );
13
14 return $result;
15 }
16
17 /*
18 * Function returns array of result expected from previous function
19 */
20 function relationship_get_expectedresult(){
21
22 $expectedResult = array(
23 'is_error' => 0,
24 'version' => 3,
25 'count' => 1,
26 'id' => 1,
27 'values' => array(
28 '1' => array(
29 'id' => '1',
30 'contact_id_a' => '36',
31 'contact_id_b' => '37',
32 'relationship_type_id' => '21',
33 'start_date' => '2008-12-20',
34 'is_active' => '1',
35 'description' => '',
36 'is_permission_a_b' => 0,
37 'is_permission_b_a' => 0,
38 'custom_5' => 'custom string',
39 'custom_5_1' => 'custom string',
40 'custom_1' => 'xyz',
41 'custom_1_-1' => 'xyz',
42 'custom_3' => '07/11/2009',
43 'custom_3_-1' => '07/11/2009',
44 'custom_4' => 'http://civicrm.org',
45 'custom_4_-1' => 'http://civicrm.org',
46 ),
47 ),
48 );
49
50 return $expectedResult ;
51 }
52
53
54 /*
55 * This example has been generated from the API test suite. The test that created it is called
56 *
57 * testGetWithCustom and can be found in
58 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/RelationshipTest.php
59 *
60 * You can see the outcome of the API tests at
61 * http://tests.dev.civicrm.org/trunk/results-api_v3
62 *
63 * To Learn about the API read
64 * http://book.civicrm.org/developer/current/techniques/api/
65 *
66 * and review the wiki at
67 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
68 *
69 * Read more about testing here
70 * http://wiki.civicrm.org/confluence/display/CRM/Testing
71 *
72 * API Standards documentation:
73 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
74 */