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