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