Merge branch '5.34' of https://github.com/civicrm/civicrm-core into upit
[civicrm-core.git] / api / v3 / RecurringEntity.php
CommitLineData
27d7d241
CW
1<?php
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
27d7d241 5 | |
a30c801b
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
27d7d241
CW
9 +--------------------------------------------------------------------+
10 */
11
12/**
13 * This api exposes CiviCRM recurring entity records.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18/**
19 * Retrieve a recurring entity.
20 *
21 * @param array $params
22 * Input parameters.
23 *
24 * @return array
25 */
26function civicrm_api3_recurring_entity_get($params) {
27 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
28}
29
30/**
31 * Adjust Metadata for Get action.
32 *
33 * The metadata is used for setting defaults, documentation & validation.
34 *
35 * @param array $params
36 * Array of parameters determined by getfields.
37 */
38function _civicrm_api3_recurring_entity_get_spec(&$params) {
cf8f0fff 39 $params['entity_table']['options'] = [
27d7d241
CW
40 'civicrm_event' => 'civicrm_event',
41 'civicrm_activity' => 'civicrm_activity',
cf8f0fff 42 ];
27d7d241
CW
43}
44
45/**
46 * Add or update a recurring entity.
47 *
48 * @param array $params
49 *
50 * @return array
51 */
52function civicrm_api3_recurring_entity_create($params) {
ddaf2161 53 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'RecurringEntity');
27d7d241
CW
54}
55
56/**
57 * Adjust Metadata for Create action.
58 *
59 * The metadata is used for setting defaults, documentation & validation.
60 *
61 * @param array $params
62 * Array of parameters determined by getfields.
63 */
64function _civicrm_api3_recurring_entity_create_spec(&$params) {
cf8f0fff 65 $params['entity_table']['options'] = [
27d7d241
CW
66 'civicrm_event' => 'civicrm_event',
67 'civicrm_activity' => 'civicrm_activity',
cf8f0fff 68 ];
df197a56 69 $params['entity_table']['api.required'] = 1;
27d7d241
CW
70}
71
72/**
73 * Deletes an existing ReportInstance.
74 *
75 * @param array $params
76 *
77 * @return array
78 */
79function civicrm_api3_recurring_entity_delete($params) {
80 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
81}