Merge pull request #16457 from colemanw/api4doc
[civicrm-core.git] / api / v3 / Entity.php
CommitLineData
6a488035 1<?php
6a488035 2
a14e9d08 3/**
61fe4988
EM
4 * Get list of deprecated entities.
5 *
244bbdd8
CW
6 * This is called by the api wrapper when returning the result of api.Entity.get.
7 *
decce855 8 * @param array $entities
61fe4988 9 *
a6c01b45 10 * @return array
16b10e64 11 * Array of deprecated api entities
a14e9d08
CW
12 */
13function _civicrm_api3_entity_deprecation($entities) {
cf8f0fff 14 $deprecated = [];
a14e9d08
CW
15 if (!empty($entities['values'])) {
16 foreach ($entities['values'] as $entity) {
eb37d603
CW
17 $apiFile = "api/v3/$entity.php";
18 @include_once $apiFile;
a14e9d08
CW
19 if (is_string(_civicrm_api3_deprecation_check($entity))) {
20 $deprecated[] = $entity;
21 }
22 }
23 }
24 return $deprecated;
25}
26
6a488035 27/**
9d32e6f7
EM
28 * Placeholder function.
29 *
30 * This should never be called, as it doesn't have any meaning.
31 *
d0997921 32 * @param array $params
9d32e6f7 33 *
645ee340 34 * @return array
6a488035
TO
35 */
36function civicrm_api3_entity_create($params) {
106a7a3a 37 return civicrm_api3_create_error("API (Entity, Create) does not exist Creating a new entity means modifying the source code of civiCRM.");
6a488035
TO
38}
39
40/**
9d32e6f7
EM
41 * Placeholder function.
42 *
43 * This should never be called, as it doesn't have any meaning.
44 *
d0997921 45 * @param array $params
9d32e6f7 46 *
645ee340 47 * @return array
6a488035
TO
48 */
49function civicrm_api3_entity_delete($params) {
106a7a3a 50 return civicrm_api3_create_error("API (Entity, Delete) does not exist Deleting an entity means modifying the source code of civiCRM.");
6a488035
TO
51}
52
53/**
9d32e6f7
EM
54 * Placeholder function.
55 *
56 * This should never be called, as it doesn't have any meaning.
57 *
d0997921 58 * @param array $params
9d32e6f7 59 *
645ee340 60 * @return array
6a488035
TO
61 */
62function 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
cf8f0fff 65 return civicrm_api3_create_success([]);
6a488035 66}