X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FContact%2FCreate.php;h=a0727ef7e0aac2e9e51f0656576950d9941bdb87;hb=d057baaba901ba7ac6633bae45316eeb351396f8;hp=8416af1ebc5f826a84e6b2af8ce43363e18acd6f;hpb=6fd0519667b8c37759460c6c1516a22210418aa5;p=civicrm-core.git diff --git a/api/v3/examples/Contact/Create.php b/api/v3/examples/Contact/Create.php index 8416af1ebc..a0727ef7e0 100644 --- a/api/v3/examples/Contact/Create.php +++ b/api/v3/examples/Contact/Create.php @@ -1,33 +1,34 @@ 'abc1', 'contact_type' => 'Individual', 'last_name' => 'xyz1', 'custom_1' => 'custom string', - ); + ]; try{ - $result = civicrm_api3('contact', 'create', $params); + $result = civicrm_api3('Contact', 'create', $params); } catch (CiviCRM_API3_Exception $e) { // Handle error here. $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( - 'error' => $errorMessage, + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,14 +42,14 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', + 'id' => 3, + 'values' => [ + '3' => [ + 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', 'do_not_email' => 0, @@ -97,18 +98,17 @@ function contact_create_expectedresult() { 'user_unique_id' => '', 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', - ), - ), - ); + ], + ], + ]; return $expectedResult; } -/** +/* * This example has been generated from the API test suite. -* The test that created it is called -* testCreateWithCustom -* and can be found in +* The test that created it is called "testCreateWithCustom" +* and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at