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