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