Merge pull request #11086 from agileware/CRM-21277
[civicrm-core.git] / CRM / SMS / DAO / Provider.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/SMS/Provider.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
4eae8dda 9 * (GenCodeChecksum:cae173c565ecbc84ccb905d80f1de8c1)
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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b
TO
31 /**
32 * SMS Provider ID
33 *
34 * @var int unsigned
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 *
65 * @var int unsigned
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 /**
e501603b
TO
82 * @var boolean
83 */
84 public $is_default;
c3fc2621 85
e501603b 86 /**
e501603b
TO
87 * @var boolean
88 */
89 public $is_active;
c3fc2621 90
4eae8dda
SL
91 /**
92 * Which Domain is this sms provider for
93 *
94 * @var int unsigned
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
SL
113 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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'),
e501603b 133 'description' => 'SMS Provider ID',
c3fc2621 134 'required' => TRUE,
522a26c9 135 'table_name' => 'civicrm_sms_provider',
136 'entity' => 'Provider',
137 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 138 'localizable' => 0,
c3fc2621
CW
139 ],
140 'name' => [
e501603b
TO
141 'name' => 'name',
142 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 143 'title' => ts('SMS Provider Name'),
e501603b
TO
144 'description' => 'Provider internal name points to option_value of option_group sms_provider_name',
145 'maxlength' => 64,
146 'size' => CRM_Utils_Type::BIG,
522a26c9 147 'table_name' => 'civicrm_sms_provider',
148 'entity' => 'Provider',
149 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 150 'localizable' => 0,
c3fc2621
CW
151 ],
152 'title' => [
e501603b
TO
153 'name' => 'title',
154 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 155 'title' => ts('SMS Provider Title'),
e501603b
TO
156 'description' => 'Provider name visible to user',
157 'maxlength' => 64,
158 'size' => CRM_Utils_Type::BIG,
522a26c9 159 'table_name' => 'civicrm_sms_provider',
160 'entity' => 'Provider',
161 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 162 'localizable' => 0,
c3fc2621 163 'html' => [
e501603b 164 'type' => 'Text',
c3fc2621
CW
165 ],
166 ],
167 'username' => [
e501603b
TO
168 'name' => 'username',
169 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 170 'title' => ts('SMS Provider Username'),
e501603b
TO
171 'maxlength' => 255,
172 'size' => CRM_Utils_Type::HUGE,
522a26c9 173 'table_name' => 'civicrm_sms_provider',
174 'entity' => 'Provider',
175 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 176 'localizable' => 0,
c3fc2621 177 'html' => [
e501603b 178 'type' => 'Text',
c3fc2621
CW
179 ],
180 ],
181 'password' => [
e501603b
TO
182 'name' => 'password',
183 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 184 'title' => ts('SMS Provider Password'),
e501603b
TO
185 'maxlength' => 255,
186 'size' => CRM_Utils_Type::HUGE,
522a26c9 187 'table_name' => 'civicrm_sms_provider',
188 'entity' => 'Provider',
189 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 190 'localizable' => 0,
c3fc2621 191 'html' => [
e501603b 192 'type' => 'Text',
c3fc2621
CW
193 ],
194 ],
195 'api_type' => [
e501603b
TO
196 'name' => 'api_type',
197 'type' => CRM_Utils_Type::T_INT,
c3fc2621 198 'title' => ts('SMS Provider API'),
e501603b 199 'description' => 'points to value in civicrm_option_value for group sms_api_type',
c3fc2621 200 'required' => TRUE,
522a26c9 201 'table_name' => 'civicrm_sms_provider',
202 'entity' => 'Provider',
203 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 204 'localizable' => 0,
c3fc2621 205 'html' => [
e501603b 206 'type' => 'Select',
c3fc2621
CW
207 ],
208 ],
209 'api_url' => [
e501603b
TO
210 'name' => 'api_url',
211 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 212 'title' => ts('SMS Provider API URL'),
e501603b
TO
213 'maxlength' => 128,
214 'size' => CRM_Utils_Type::HUGE,
522a26c9 215 'table_name' => 'civicrm_sms_provider',
216 'entity' => 'Provider',
217 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 218 'localizable' => 0,
c3fc2621 219 'html' => [
e501603b 220 'type' => 'Text',
c3fc2621
CW
221 ],
222 ],
223 'api_params' => [
e501603b
TO
224 'name' => 'api_params',
225 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 226 'title' => ts('SMS Provider API Params'),
e501603b 227 'description' => 'the api params in xml, http or smtp format',
522a26c9 228 'table_name' => 'civicrm_sms_provider',
229 'entity' => 'Provider',
230 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 231 'localizable' => 0,
c3fc2621 232 'html' => [
e501603b 233 'type' => 'Text',
c3fc2621
CW
234 ],
235 ],
236 'is_default' => [
e501603b
TO
237 'name' => 'is_default',
238 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 239 'title' => ts('SMS Provider is Default?'),
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' => 'CheckBox',
c3fc2621
CW
246 ],
247 ],
248 'is_active' => [
e501603b
TO
249 'name' => 'is_active',
250 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 251 'title' => ts('SMS Provider is Active?'),
522a26c9 252 'table_name' => 'civicrm_sms_provider',
253 'entity' => 'Provider',
254 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 255 'localizable' => 0,
c3fc2621 256 'html' => [
e501603b 257 'type' => 'CheckBox',
c3fc2621
CW
258 ],
259 ],
260 'domain_id' => [
4eae8dda
SL
261 'name' => 'domain_id',
262 'type' => CRM_Utils_Type::T_INT,
c3fc2621 263 'title' => ts('SMS Domain'),
4eae8dda
SL
264 'description' => 'Which Domain is this sms provider for',
265 'table_name' => 'civicrm_sms_provider',
266 'entity' => 'Provider',
267 'bao' => 'CRM_SMS_BAO_Provider',
6a7e5e5d 268 'localizable' => 0,
4eae8dda 269 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 270 'pseudoconstant' => [
4eae8dda
SL
271 'table' => 'civicrm_domain',
272 'keyColumn' => 'id',
273 'labelColumn' => 'name',
c3fc2621
CW
274 ]
275 ],
276 ];
346aaaba 277 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 278 }
346aaaba 279 return Civi::$statics[__CLASS__]['fields'];
e501603b 280 }
c3fc2621 281
e501603b 282 /**
bd8e0b14 283 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
284 *
285 * @return array
bd8e0b14 286 * Array(string $name => string $uniqueName).
e501603b 287 */
c3fc2621 288 public static function &fieldKeys() {
bd8e0b14
TO
289 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
290 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 291 }
bd8e0b14 292 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 293 }
c3fc2621 294
e501603b
TO
295 /**
296 * Returns the names of this table
297 *
298 * @return string
299 */
c3fc2621 300 public static function getTableName() {
e501603b
TO
301 return self::$_tableName;
302 }
c3fc2621 303
e501603b
TO
304 /**
305 * Returns if this table needs to be logged
306 *
c3fc2621 307 * @return bool
e501603b 308 */
c3fc2621 309 public function getLog() {
e501603b
TO
310 return self::$_log;
311 }
c3fc2621 312
e501603b
TO
313 /**
314 * Returns the list of fields that can be imported
315 *
316 * @param bool $prefix
317 *
318 * @return array
319 */
c3fc2621
CW
320 public static function &import($prefix = FALSE) {
321 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []);
60808919 322 return $r;
e501603b 323 }
c3fc2621 324
e501603b
TO
325 /**
326 * Returns the list of fields that can be exported
327 *
328 * @param bool $prefix
329 *
330 * @return array
331 */
c3fc2621
CW
332 public static function &export($prefix = FALSE) {
333 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []);
60808919 334 return $r;
e501603b 335 }
c3fc2621 336
e7a6b91a
AS
337 /**
338 * Returns the list of indices
c3fc2621
CW
339 *
340 * @param bool $localize
341 *
342 * @return array
e7a6b91a
AS
343 */
344 public static function indices($localize = TRUE) {
c3fc2621 345 $indices = [];
e7a6b91a
AS
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
347 }
c3fc2621 348
e501603b 349}