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