Merge pull request #17370 from eileenmcnaughton/to
[civicrm-core.git] / api / v3 / Entity.php
1 <?php
2
3 /**
4 * Get list of deprecated entities.
5 *
6 * This is called by the api wrapper when returning the result of api.Entity.get.
7 *
8 * @param array $entities
9 *
10 * @return array
11 * Array of deprecated api entities
12 */
13 function _civicrm_api3_entity_deprecation($entities) {
14 $deprecated = [];
15 if (!empty($entities['values'])) {
16 foreach ($entities['values'] as $entity) {
17 $apiFile = "api/v3/$entity.php";
18 @include_once $apiFile;
19 if (is_string(_civicrm_api3_deprecation_check($entity))) {
20 $deprecated[] = $entity;
21 }
22 }
23 }
24 return $deprecated;
25 }
26
27 /**
28 * Placeholder function.
29 *
30 * This should never be called, as it doesn't have any meaning.
31 *
32 * @param array $params
33 *
34 * @return array
35 */
36 function civicrm_api3_entity_create($params) {
37 return civicrm_api3_create_error("API (Entity, Create) does not exist Creating a new entity means modifying the source code of civiCRM.");
38 }
39
40 /**
41 * Placeholder function.
42 *
43 * This should never be called, as it doesn't have any meaning.
44 *
45 * @param array $params
46 *
47 * @return array
48 */
49 function civicrm_api3_entity_delete($params) {
50 return civicrm_api3_create_error("API (Entity, Delete) does not exist Deleting an entity means modifying the source code of civiCRM.");
51 }
52
53 /**
54 * Placeholder function.
55 *
56 * This should never be called, as it doesn't have any meaning.
57 *
58 * @param array $params
59 *
60 * @return array
61 */
62 function civicrm_api3_entity_getfields($params) {
63 // we return an empty array so it makes it easier to write generic getdefaults / required tests
64 // without putting an exception in for entity
65 return civicrm_api3_create_success([]);
66 }