Merge pull request #17595 from eileenmcnaughton/settings
[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:6ecda65bd52b36e04764cec8ee81e1b8)
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 public static function getEntityTitle() {
112 return ts('Providers');
113 }
114
115 /**
116 * Returns foreign keys and entity references.
117 *
118 * @return array
119 * [CRM_Core_Reference_Interface]
120 */
121 public static function getReferenceColumns() {
122 if (!isset(Civi::$statics[__CLASS__]['links'])) {
123 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
124 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
125 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
126 }
127 return Civi::$statics[__CLASS__]['links'];
128 }
129
130 /**
131 * Returns all the column names of this table
132 *
133 * @return array
134 */
135 public static function &fields() {
136 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
137 Civi::$statics[__CLASS__]['fields'] = [
138 'id' => [
139 'name' => 'id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('SMS Provider ID'),
142 'description' => ts('SMS Provider ID'),
143 'required' => TRUE,
144 'where' => 'civicrm_sms_provider.id',
145 'table_name' => 'civicrm_sms_provider',
146 'entity' => 'Provider',
147 'bao' => 'CRM_SMS_BAO_Provider',
148 'localizable' => 0,
149 'add' => '4.2',
150 ],
151 'name' => [
152 'name' => 'name',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('SMS Provider Name'),
155 'description' => ts('Provider internal name points to option_value of option_group sms_provider_name'),
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
158 'where' => 'civicrm_sms_provider.name',
159 'table_name' => 'civicrm_sms_provider',
160 'entity' => 'Provider',
161 'bao' => 'CRM_SMS_BAO_Provider',
162 'localizable' => 0,
163 'add' => '4.2',
164 ],
165 'title' => [
166 'name' => 'title',
167 'type' => CRM_Utils_Type::T_STRING,
168 'title' => ts('SMS Provider Title'),
169 'description' => ts('Provider name visible to user'),
170 'maxlength' => 64,
171 'size' => CRM_Utils_Type::BIG,
172 'where' => 'civicrm_sms_provider.title',
173 'table_name' => 'civicrm_sms_provider',
174 'entity' => 'Provider',
175 'bao' => 'CRM_SMS_BAO_Provider',
176 'localizable' => 0,
177 'html' => [
178 'type' => 'Text',
179 ],
180 'add' => '4.2',
181 ],
182 'username' => [
183 'name' => 'username',
184 'type' => CRM_Utils_Type::T_STRING,
185 'title' => ts('SMS Provider Username'),
186 'maxlength' => 255,
187 'size' => CRM_Utils_Type::HUGE,
188 'where' => 'civicrm_sms_provider.username',
189 'table_name' => 'civicrm_sms_provider',
190 'entity' => 'Provider',
191 'bao' => 'CRM_SMS_BAO_Provider',
192 'localizable' => 0,
193 'html' => [
194 'type' => 'Text',
195 ],
196 'add' => '4.2',
197 ],
198 'password' => [
199 'name' => 'password',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('SMS Provider Password'),
202 'maxlength' => 255,
203 'size' => CRM_Utils_Type::HUGE,
204 'where' => 'civicrm_sms_provider.password',
205 'table_name' => 'civicrm_sms_provider',
206 'entity' => 'Provider',
207 'bao' => 'CRM_SMS_BAO_Provider',
208 'localizable' => 0,
209 'html' => [
210 'type' => 'Text',
211 ],
212 'add' => '4.2',
213 ],
214 'api_type' => [
215 'name' => 'api_type',
216 'type' => CRM_Utils_Type::T_INT,
217 'title' => ts('SMS Provider API'),
218 'description' => ts('points to value in civicrm_option_value for group sms_api_type'),
219 'required' => TRUE,
220 'where' => 'civicrm_sms_provider.api_type',
221 'table_name' => 'civicrm_sms_provider',
222 'entity' => 'Provider',
223 'bao' => 'CRM_SMS_BAO_Provider',
224 'localizable' => 0,
225 'html' => [
226 'type' => 'Select',
227 ],
228 'pseudoconstant' => [
229 'optionGroupName' => 'sms_api_type',
230 'optionEditPath' => 'civicrm/admin/options/sms_api_type',
231 ],
232 'add' => '4.2',
233 ],
234 'api_url' => [
235 'name' => 'api_url',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('SMS Provider API URL'),
238 'maxlength' => 128,
239 'size' => CRM_Utils_Type::HUGE,
240 'where' => 'civicrm_sms_provider.api_url',
241 'table_name' => 'civicrm_sms_provider',
242 'entity' => 'Provider',
243 'bao' => 'CRM_SMS_BAO_Provider',
244 'localizable' => 0,
245 'html' => [
246 'type' => 'Text',
247 ],
248 'add' => '4.2',
249 ],
250 'api_params' => [
251 'name' => 'api_params',
252 'type' => CRM_Utils_Type::T_TEXT,
253 'title' => ts('SMS Provider API Params'),
254 'description' => ts('the api params in xml, http or smtp format'),
255 'where' => 'civicrm_sms_provider.api_params',
256 'table_name' => 'civicrm_sms_provider',
257 'entity' => 'Provider',
258 'bao' => 'CRM_SMS_BAO_Provider',
259 'localizable' => 0,
260 'html' => [
261 'type' => 'Text',
262 ],
263 'add' => '4.2',
264 ],
265 'is_default' => [
266 'name' => 'is_default',
267 'type' => CRM_Utils_Type::T_BOOLEAN,
268 'title' => ts('SMS Provider is Default?'),
269 'where' => 'civicrm_sms_provider.is_default',
270 'default' => '0',
271 'table_name' => 'civicrm_sms_provider',
272 'entity' => 'Provider',
273 'bao' => 'CRM_SMS_BAO_Provider',
274 'localizable' => 0,
275 'html' => [
276 'type' => 'CheckBox',
277 ],
278 'add' => '4.2',
279 ],
280 'is_active' => [
281 'name' => 'is_active',
282 'type' => CRM_Utils_Type::T_BOOLEAN,
283 'title' => ts('SMS Provider is Active?'),
284 'where' => 'civicrm_sms_provider.is_active',
285 'default' => '0',
286 'table_name' => 'civicrm_sms_provider',
287 'entity' => 'Provider',
288 'bao' => 'CRM_SMS_BAO_Provider',
289 'localizable' => 0,
290 'html' => [
291 'type' => 'CheckBox',
292 ],
293 'add' => '4.2',
294 ],
295 'domain_id' => [
296 'name' => 'domain_id',
297 'type' => CRM_Utils_Type::T_INT,
298 'title' => ts('SMS Domain'),
299 'description' => ts('Which Domain is this sms provider for'),
300 'where' => 'civicrm_sms_provider.domain_id',
301 'table_name' => 'civicrm_sms_provider',
302 'entity' => 'Provider',
303 'bao' => 'CRM_SMS_BAO_Provider',
304 'localizable' => 0,
305 'FKClassName' => 'CRM_Core_DAO_Domain',
306 'pseudoconstant' => [
307 'table' => 'civicrm_domain',
308 'keyColumn' => 'id',
309 'labelColumn' => 'name',
310 ],
311 'add' => '4.7',
312 ],
313 ];
314 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
315 }
316 return Civi::$statics[__CLASS__]['fields'];
317 }
318
319 /**
320 * Return a mapping from field-name to the corresponding key (as used in fields()).
321 *
322 * @return array
323 * Array(string $name => string $uniqueName).
324 */
325 public static function &fieldKeys() {
326 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
327 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
328 }
329 return Civi::$statics[__CLASS__]['fieldKeys'];
330 }
331
332 /**
333 * Returns the names of this table
334 *
335 * @return string
336 */
337 public static function getTableName() {
338 return self::$_tableName;
339 }
340
341 /**
342 * Returns if this table needs to be logged
343 *
344 * @return bool
345 */
346 public function getLog() {
347 return self::$_log;
348 }
349
350 /**
351 * Returns the list of fields that can be imported
352 *
353 * @param bool $prefix
354 *
355 * @return array
356 */
357 public static function &import($prefix = FALSE) {
358 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []);
359 return $r;
360 }
361
362 /**
363 * Returns the list of fields that can be exported
364 *
365 * @param bool $prefix
366 *
367 * @return array
368 */
369 public static function &export($prefix = FALSE) {
370 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []);
371 return $r;
372 }
373
374 /**
375 * Returns the list of indices
376 *
377 * @param bool $localize
378 *
379 * @return array
380 */
381 public static function indices($localize = TRUE) {
382 $indices = [];
383 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
384 }
385
386 }