Merge pull request #18631 from eileenmcnaughton/ppp
[civicrm-core.git] / CRM / SMS / DAO / Provider.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/SMS/Provider.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:478e0d0caeb2d2a81068db6ad2db67aa)
10 */
11
12 /**
13 * Database access object for the Provider entity.
14 */
15 class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.2';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_sms_provider';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * SMS Provider ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Provider internal name points to option_value of option_group sms_provider_name
42 *
43 * @var string
44 */
45 public $name;
46
47 /**
48 * Provider name visible to user
49 *
50 * @var string
51 */
52 public $title;
53
54 /**
55 * @var string
56 */
57 public $username;
58
59 /**
60 * @var string
61 */
62 public $password;
63
64 /**
65 * points to value in civicrm_option_value for group sms_api_type
66 *
67 * @var int
68 */
69 public $api_type;
70
71 /**
72 * @var string
73 */
74 public $api_url;
75
76 /**
77 * the api params in xml, http or smtp format
78 *
79 * @var text
80 */
81 public $api_params;
82
83 /**
84 * @var bool
85 */
86 public $is_default;
87
88 /**
89 * @var bool
90 */
91 public $is_active;
92
93 /**
94 * Which Domain is this sms provider for
95 *
96 * @var int
97 */
98 public $domain_id;
99
100 /**
101 * Class constructor.
102 */
103 public function __construct() {
104 $this->__table = 'civicrm_sms_provider';
105 parent::__construct();
106 }
107
108 /**
109 * Returns localized title of this entity.
110 *
111 * @param bool $plural
112 * Whether to return the plural version of the title.
113 */
114 public static function getEntityTitle($plural = FALSE) {
115 return $plural ? ts('Providers') : ts('Provider');
116 }
117
118 /**
119 * Returns foreign keys and entity references.
120 *
121 * @return array
122 * [CRM_Core_Reference_Interface]
123 */
124 public static function getReferenceColumns() {
125 if (!isset(Civi::$statics[__CLASS__]['links'])) {
126 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
127 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
128 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
129 }
130 return Civi::$statics[__CLASS__]['links'];
131 }
132
133 /**
134 * Returns all the column names of this table
135 *
136 * @return array
137 */
138 public static function &fields() {
139 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
140 Civi::$statics[__CLASS__]['fields'] = [
141 'id' => [
142 'name' => 'id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('SMS Provider ID'),
145 'description' => ts('SMS Provider ID'),
146 'required' => TRUE,
147 'where' => 'civicrm_sms_provider.id',
148 'table_name' => 'civicrm_sms_provider',
149 'entity' => 'Provider',
150 'bao' => 'CRM_SMS_BAO_Provider',
151 'localizable' => 0,
152 'add' => '4.2',
153 ],
154 'name' => [
155 'name' => 'name',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('SMS Provider Name'),
158 'description' => ts('Provider internal name points to option_value of option_group sms_provider_name'),
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'where' => 'civicrm_sms_provider.name',
162 'table_name' => 'civicrm_sms_provider',
163 'entity' => 'Provider',
164 'bao' => 'CRM_SMS_BAO_Provider',
165 'localizable' => 0,
166 'add' => '4.2',
167 ],
168 'title' => [
169 'name' => 'title',
170 'type' => CRM_Utils_Type::T_STRING,
171 'title' => ts('SMS Provider Title'),
172 'description' => ts('Provider name visible to user'),
173 'maxlength' => 64,
174 'size' => CRM_Utils_Type::BIG,
175 'where' => 'civicrm_sms_provider.title',
176 'table_name' => 'civicrm_sms_provider',
177 'entity' => 'Provider',
178 'bao' => 'CRM_SMS_BAO_Provider',
179 'localizable' => 0,
180 'html' => [
181 'type' => 'Text',
182 ],
183 'add' => '4.2',
184 ],
185 'username' => [
186 'name' => 'username',
187 'type' => CRM_Utils_Type::T_STRING,
188 'title' => ts('SMS Provider Username'),
189 'maxlength' => 255,
190 'size' => CRM_Utils_Type::HUGE,
191 'where' => 'civicrm_sms_provider.username',
192 'table_name' => 'civicrm_sms_provider',
193 'entity' => 'Provider',
194 'bao' => 'CRM_SMS_BAO_Provider',
195 'localizable' => 0,
196 'html' => [
197 'type' => 'Text',
198 ],
199 'add' => '4.2',
200 ],
201 'password' => [
202 'name' => 'password',
203 'type' => CRM_Utils_Type::T_STRING,
204 'title' => ts('SMS Provider Password'),
205 'maxlength' => 255,
206 'size' => CRM_Utils_Type::HUGE,
207 'where' => 'civicrm_sms_provider.password',
208 'table_name' => 'civicrm_sms_provider',
209 'entity' => 'Provider',
210 'bao' => 'CRM_SMS_BAO_Provider',
211 'localizable' => 0,
212 'html' => [
213 'type' => 'Text',
214 ],
215 'add' => '4.2',
216 ],
217 'api_type' => [
218 'name' => 'api_type',
219 'type' => CRM_Utils_Type::T_INT,
220 'title' => ts('SMS Provider API'),
221 'description' => ts('points to value in civicrm_option_value for group sms_api_type'),
222 'required' => TRUE,
223 'where' => 'civicrm_sms_provider.api_type',
224 'table_name' => 'civicrm_sms_provider',
225 'entity' => 'Provider',
226 'bao' => 'CRM_SMS_BAO_Provider',
227 'localizable' => 0,
228 'html' => [
229 'type' => 'Select',
230 ],
231 'pseudoconstant' => [
232 'optionGroupName' => 'sms_api_type',
233 'optionEditPath' => 'civicrm/admin/options/sms_api_type',
234 ],
235 'add' => '4.2',
236 ],
237 'api_url' => [
238 'name' => 'api_url',
239 'type' => CRM_Utils_Type::T_STRING,
240 'title' => ts('SMS Provider API URL'),
241 'maxlength' => 128,
242 'size' => CRM_Utils_Type::HUGE,
243 'where' => 'civicrm_sms_provider.api_url',
244 'table_name' => 'civicrm_sms_provider',
245 'entity' => 'Provider',
246 'bao' => 'CRM_SMS_BAO_Provider',
247 'localizable' => 0,
248 'html' => [
249 'type' => 'Text',
250 ],
251 'add' => '4.2',
252 ],
253 'api_params' => [
254 'name' => 'api_params',
255 'type' => CRM_Utils_Type::T_TEXT,
256 'title' => ts('SMS Provider API Params'),
257 'description' => ts('the api params in xml, http or smtp format'),
258 'where' => 'civicrm_sms_provider.api_params',
259 'table_name' => 'civicrm_sms_provider',
260 'entity' => 'Provider',
261 'bao' => 'CRM_SMS_BAO_Provider',
262 'localizable' => 0,
263 'html' => [
264 'type' => 'Text',
265 ],
266 'add' => '4.2',
267 ],
268 'is_default' => [
269 'name' => 'is_default',
270 'type' => CRM_Utils_Type::T_BOOLEAN,
271 'title' => ts('SMS Provider is Default?'),
272 'where' => 'civicrm_sms_provider.is_default',
273 'default' => '0',
274 'table_name' => 'civicrm_sms_provider',
275 'entity' => 'Provider',
276 'bao' => 'CRM_SMS_BAO_Provider',
277 'localizable' => 0,
278 'html' => [
279 'type' => 'CheckBox',
280 ],
281 'add' => '4.2',
282 ],
283 'is_active' => [
284 'name' => 'is_active',
285 'type' => CRM_Utils_Type::T_BOOLEAN,
286 'title' => ts('SMS Provider is Active?'),
287 'where' => 'civicrm_sms_provider.is_active',
288 'default' => '0',
289 'table_name' => 'civicrm_sms_provider',
290 'entity' => 'Provider',
291 'bao' => 'CRM_SMS_BAO_Provider',
292 'localizable' => 0,
293 'html' => [
294 'type' => 'CheckBox',
295 ],
296 'add' => '4.2',
297 ],
298 'domain_id' => [
299 'name' => 'domain_id',
300 'type' => CRM_Utils_Type::T_INT,
301 'title' => ts('SMS Domain'),
302 'description' => ts('Which Domain is this sms provider for'),
303 'where' => 'civicrm_sms_provider.domain_id',
304 'table_name' => 'civicrm_sms_provider',
305 'entity' => 'Provider',
306 'bao' => 'CRM_SMS_BAO_Provider',
307 'localizable' => 0,
308 'FKClassName' => 'CRM_Core_DAO_Domain',
309 'pseudoconstant' => [
310 'table' => 'civicrm_domain',
311 'keyColumn' => 'id',
312 'labelColumn' => 'name',
313 ],
314 'add' => '4.7',
315 ],
316 ];
317 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
318 }
319 return Civi::$statics[__CLASS__]['fields'];
320 }
321
322 /**
323 * Return a mapping from field-name to the corresponding key (as used in fields()).
324 *
325 * @return array
326 * Array(string $name => string $uniqueName).
327 */
328 public static function &fieldKeys() {
329 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
330 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
331 }
332 return Civi::$statics[__CLASS__]['fieldKeys'];
333 }
334
335 /**
336 * Returns the names of this table
337 *
338 * @return string
339 */
340 public static function getTableName() {
341 return self::$_tableName;
342 }
343
344 /**
345 * Returns if this table needs to be logged
346 *
347 * @return bool
348 */
349 public function getLog() {
350 return self::$_log;
351 }
352
353 /**
354 * Returns the list of fields that can be imported
355 *
356 * @param bool $prefix
357 *
358 * @return array
359 */
360 public static function &import($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []);
362 return $r;
363 }
364
365 /**
366 * Returns the list of fields that can be exported
367 *
368 * @param bool $prefix
369 *
370 * @return array
371 */
372 public static function &export($prefix = FALSE) {
373 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []);
374 return $r;
375 }
376
377 /**
378 * Returns the list of indices
379 *
380 * @param bool $localize
381 *
382 * @return array
383 */
384 public static function indices($localize = TRUE) {
385 $indices = [];
386 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
387 }
388
389 }