4 /*this demonstrates the usage of chained api functions. Specifically it has one 'parent function' &
5 2 child functions - one receives values from the parent (Contact) and the other child (Tag).
7 function contact_create_example(){
10 'display_name' => 'batman',
11 'contact_type' => 'Individual',
12 'api.tag.create' => array(
13 'name' => '$value.id',
14 'description' => '$value.display_name',
15 'format.only_id' => 1,
17 'api.entity_tag.create' => array(
18 'tag_id' => '$value.api.tag.create',
22 $result = civicrm_api( 'contact','create',$params );
28 * Function returns array of result expected from previous function
30 function contact_create_expectedresult(){
32 $expectedResult = array(
40 'contact_type' => 'Individual',
41 'contact_sub_type' => '',
48 'legal_identifier' => '',
49 'external_identifier' => '',
51 'display_name' => 'batman',
55 'preferred_communication_method' => '',
56 'preferred_language' => 'en_US',
57 'preferred_mail_format' => 'Both',
58 'hash' => '67eac7789eaee00',
65 'email_greeting_id' => '1',
66 'email_greeting_custom' => '',
67 'email_greeting_display' => '',
68 'postal_greeting_id' => '1',
69 'postal_greeting_custom' => '',
70 'postal_greeting_display' => '',
71 'addressee_id' => '1',
72 'addressee_custom' => '',
73 'addressee_display' => '',
78 'deceased_date' => '',
79 'household_name' => '',
80 'primary_contact_id' => '',
81 'organization_name' => '',
83 'user_unique_id' => '',
84 'created_date' => '20120130621222105',
85 'modified_date' => '2012-11-14 16:02:35',
86 'api.tag.create' => 6,
87 'api.entity_tag.create' => array(
97 return $expectedResult ;
102 * This example has been generated from the API test suite. The test that created it is called
104 * testChainingValuesCreate and can be found in
105 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
107 * You can see the outcome of the API tests at
108 * http://tests.dev.civicrm.org/trunk/results-api_v3
110 * To Learn about the API read
111 * http://book.civicrm.org/developer/current/techniques/api/
113 * and review the wiki at
114 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
116 * Read more about testing here
117 * http://wiki.civicrm.org/confluence/display/CRM/Testing
119 * API Standards documentation:
120 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards