Merge pull request #22966 from eileenmcnaughton/retrieve
[civicrm-core.git] / api / v3 / examples / StatusPreference / Delete.ex.php
CommitLineData
1d8ee3d6 1<?php
85651a60
EM
2
3/**
4 * @file
5 */
6
1d8ee3d6 7/**
8 * Test Generated example demonstrating the StatusPreference.delete API.
9 *
10 * @return array
11 * API result array
12 */
13function status_preference_delete_example() {
cf8f0fff 14 $params = [
923d8900 15 'id' => 3,
cf8f0fff 16 ];
1d8ee3d6 17
85651a60 18 try {
1d8ee3d6 19 $result = civicrm_api3('StatusPreference', 'delete', $params);
20 }
21 catch (CiviCRM_API3_Exception $e) {
22 // Handle error here.
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
cf8f0fff 26 return [
1d8ee3d6 27 'is_error' => 1,
28 'error_message' => $errorMessage,
29 'error_code' => $errorCode,
30 'error_data' => $errorData,
cf8f0fff 31 ];
1d8ee3d6 32 }
33
34 return $result;
35}
36
37/**
38 * Function returns array of result expected from previous function.
39 *
40 * @return array
41 * API result array
42 */
43function status_preference_delete_expectedresult() {
44
cf8f0fff 45 $expectedResult = [
1d8ee3d6 46 'is_error' => 0,
47 'version' => 3,
48 'count' => 1,
49 'values' => 1,
cf8f0fff 50 ];
1d8ee3d6 51
52 return $expectedResult;
53}
54
55/*
85651a60
EM
56 * This example has been generated from the API test suite.
57 * The test that created it is called "testDeleteStatusPreference"
58 * and can be found at:
59 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php
60 *
61 * You can see the outcome of the API tests at
62 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
63 *
64 * To Learn about the API read
65 * https://docs.civicrm.org/dev/en/latest/api/
66 *
67 * Browse the API on your own site with the API Explorer. It is in the main
68 * CiviCRM menu, under: Support > Development > API Explorer.
69 *
70 * Read more about testing here
71 * https://docs.civicrm.org/dev/en/latest/testing/
72 *
73 * API Standards documentation:
74 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
75 */