Merge pull request #16226 from civicrm/5.22
[civicrm-core.git] / api / v3 / EntityBatch.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+ */
10
11 /**
12 * This api exposes CiviCRM EntityBatch records.
13 *
14 * Use this api to add/remove entities from a batch.
15 * To create/update/delete the batches themselves, use the Batch api.
16 *
17 * @package CiviCRM_APIv3
18 */
19
20 /**
21 * Get entity batches.
22 *
23 * @param array $params
24 *
25 * @return array
26 */
27 function civicrm_api3_entity_batch_get($params) {
28 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
29 }
30
31 /**
32 * Adjust Metadata for Create action.
33 *
34 * The metadata is used for setting defaults, documentation & validation.
35 *
36 * @param array $params
37 * Array of parameters determined by getfields.
38 */
39 function _civicrm_api3_entity_batch_create_spec(&$params) {
40 $params['entity_id']['api.required'] = 1;
41 $params['batch_id']['api.required'] = 1;
42 }
43
44 /**
45 * Create an entity batch.
46 *
47 * @param array $params
48 *
49 * @return array
50 */
51 function civicrm_api3_entity_batch_create($params) {
52 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'EntityBatch');
53 }
54
55 /**
56 * Mark entity batch as removed.
57 *
58 * @param array $params
59 *
60 * @return array
61 */
62 function civicrm_api3_entity_batch_delete($params) {
63 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
64 }