X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FSetting%2FGetSpecifiedDomains.php;h=989831e277dbd018636f7fb54c42418f7ecdd298;hb=244bbdd85415317b95f70bf85a3ecb036c4fe840;hp=b112c5bb887d8d4292d8cf78dde296c094af4d18;hpb=4c95b949e863281d990ffa2a3104415079e6352d;p=civicrm-core.git diff --git a/api/v3/examples/Setting/GetSpecifiedDomains.php b/api/v3/examples/Setting/GetSpecifiedDomains.php index b112c5bb88..989831e277 100644 --- a/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -1,60 +1,71 @@ array( +function setting_get_example() { + $params = array( + 'domain_id' => array( '0' => 1, '1' => 2, ), - 'return' => array( + 'return' => array( '0' => 'uniq_email_per_site', ), -); + ); -try{ - $result = civicrm_api3('setting', 'Get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('setting', 'Get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_get_expectedresult(){ +function setting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => array( - 'uniq_email_per_site' => 0, - ), + 'uniq_email_per_site' => 0, + ), '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSettingMultipleDomains and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSettingMultipleDomains +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at @@ -64,7 +75,7 @@ function setting_get_expectedresult(){ * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API * * Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api/explorer +* http://MYSITE.ORG/path/to/civicrm/api * * Read more about testing here * http://wiki.civicrm.org/confluence/display/CRM/Testing