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