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