3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
13 * This api exposes the relationships between organizations and CiviCRM groups.
15 * @package CiviCRM_APIv3
19 * Get group organization record/s.
21 * @param array $params
22 * Name value pair of contact information.
25 * list of groups, given contact subscribed to
27 function civicrm_api3_group_organization_get($params) {
28 return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupOrganization', $params);
32 * Create group organization record.
34 * @param array $params
39 function civicrm_api3_group_organization_create($params) {
41 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'GroupOrganization');
45 * Adjust Metadata for Create action.
47 * The metadata is used for setting defaults, documentation & validation.
49 * @param array $params
50 * Array of parameters determined by getfields.
52 function _civicrm_api3_group_organization_create_spec(&$params) {
53 $params['organization_id']['api.required'] = 1;
54 $params['group_id']['api.required'] = 1;
58 * Deletes an existing Group Organization.
60 * This API is used for deleting a Group Organization
62 * @param array $params
63 * With 'id' = ID of the Group Organization to be deleted.
68 function civicrm_api3_group_organization_delete($params) {
70 $result = CRM_Contact_BAO_GroupOrganization
::deleteGroupOrganization($params['id']);
71 return $result ?
civicrm_api3_create_success('Deleted Group Organization successfully') : civicrm_api3_create_error('Could not delete Group Organization');