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