Cleanup api3 docblocks
[civicrm-core.git] / api / v3 / MailingGroup.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * APIv3 functions for registering/processing mailing group events.
30 *
31 * @deprecated
32 * @package CiviCRM_APIv3
33 * @subpackage API_MailerGroup
34 */
35
36 /**
37 * Declare deprecated functions.
38 *
39 * @deprecated api notice
40 * @return string
41 * to indicate this entire api entity is deprecated
42 */
43 function _civicrm_api3_mailing_group_deprecation() {
44 return 'The mailing_group api is deprecated. Use the mailing_event apis instead.';
45 }
46
47 /**
48 * Handle an unsubscribe event.
49 *
50 * @deprecated
51 *
52 * @param array $params
53 *
54 * @return array
55 */
56 function civicrm_api3_mailing_group_event_unsubscribe($params) {
57 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
58 }
59
60 /**
61 * Handle a site-level unsubscribe event.
62 *
63 * @deprecated
64 *
65 * @param array $params
66 *
67 * @return array
68 */
69 function civicrm_api3_mailing_group_event_domain_unsubscribe($params) {
70 $params['org_unsubscribe'] = 1;
71 return civicrm_api('mailing_event_unsubscribe', 'create', $params);
72 }
73
74 /**
75 * Handle a re-subscription event.
76 *
77 * @deprecated
78 *
79 * @param array $params
80 *
81 * @return array
82 */
83 function civicrm_api3_mailing_group_event_resubscribe($params) {
84 return civicrm_api('mailing_event_resubscribe', 'create', $params);
85 }
86
87 /**
88 * Handle a subscription event.
89 *
90 * @deprecated
91 *
92 * @param array $params
93 *
94 * @return array
95 */
96 function civicrm_api3_mailing_group_event_subscribe($params) {
97 return civicrm_api('mailing_event_subscribe', 'create', $params);
98 }
99
100 /**
101 * Create mailing group.
102 *
103 * @param array $params
104 *
105 * @return array
106 * @throws \API_Exception
107 */
108 function civicrm_api3_mailing_group_create($params) {
109 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
110 }
111
112 /**
113 * Get mailing group.
114 *
115 * @param array $params
116 *
117 * @return array
118 */
119 function civicrm_api3_mailing_group_get($params) {
120 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
121 }
122
123 /**
124 * Delete mailing group.
125 *
126 * @param array $params
127 *
128 * @return array
129 * @throws \API_Exception
130 */
131 function civicrm_api3_mailing_group_delete($params) {
132 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
133 }
134
135 /**
136 * Get metadata for mailing group functions.
137 *
138 * @param array $params
139 *
140 * @return array
141 */
142 function civicrm_api3_mailing_group_getfields($params) {
143 $dao = _civicrm_api3_get_DAO('Subscribe');
144 $d = new $dao();
145 $fields = $d->fields();
146 $d->free();
147
148 $dao = _civicrm_api3_get_DAO('Unsubscribe');
149 $d = new $dao();
150 $fields = $fields + $d->fields();
151 $d->free();
152
153 // CRM-13830 - prevent the api wrapper from helping out with pseudoconstants
154 // Since these fields don't belong to this entity it will fail
155 foreach ($fields as &$field) {
156 unset($field['pseudoconstant']);
157 }
158
159 return civicrm_api3_create_success($fields, $params, 'mailing_group', 'getfields');
160 }