APIv4 - Fix bug when using relative date filters in ON clause of a join
[civicrm-core.git] / api / v3 / UFJoin.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 /**
13 * This api exposes CiviCRM user framework join.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Takes an associative array and creates a uf join in the database.
20 *
21 * @param array $params
22 * Array per getfields metadata.
23 *
24 * @return array
25 * CRM_Core_DAO_UFJoin Array
26 */
27 function civicrm_api3_uf_join_create($params) {
28
29 $ufJoin = CRM_Core_BAO_UFJoin::create($params);
30 _civicrm_api3_object_to_array($ufJoin, $ufJoinArray[]);
31 return civicrm_api3_create_success($ufJoinArray, $params, 'UFJoin', 'create');
32 }
33
34 /**
35 * Adjust Metadata for Create action.
36 *
37 * @param array $params
38 * Array of parameters determined by getfields.
39 *
40 * @todo - suspect module, weight don't need to be required - need to test
41 */
42 function _civicrm_api3_uf_join_create_spec(&$params) {
43 $params['module']['api.required'] = 1;
44 $params['weight']['api.required'] = 1;
45 $params['uf_group_id']['api.required'] = 1;
46 }
47
48 /**
49 * Get CiviCRM UF_Joins (ie joins between CMS user records & CiviCRM user record.
50 *
51 * @param array $params
52 * Array of name/value pairs.
53 *
54 * @return array
55 * API result array.
56 */
57 function civicrm_api3_uf_join_get($params) {
58 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
59 }
60
61 /**
62 * Delete a CiviCRM UF_Join.
63 *
64 * @param array $params
65 * Array of name/value pairs.
66 *
67 * @return array
68 * API result array.
69 */
70 function civicrm_api3_uf_join_delete($params) {
71 return _civicrm_api3_basic_delete('CRM_Core_BAO_UFJoin', $params);
72 }