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