Merge pull request #11773 from civicrm/4.7.31-rc
[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' => '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' => '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' => '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' => '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' => '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 'table_name' => 'civicrm_sms_provider',
241 'entity' => 'Provider',
242 'bao' => 'CRM_SMS_BAO_Provider',
243 'localizable' => 0,
244 'html' => [
245 'type' => 'CheckBox',
246 ],
247 ],
248 'is_active' => [
249 'name' => 'is_active',
250 'type' => CRM_Utils_Type::T_BOOLEAN,
251 'title' => ts('SMS Provider is Active?'),
252 'table_name' => 'civicrm_sms_provider',
253 'entity' => 'Provider',
254 'bao' => 'CRM_SMS_BAO_Provider',
255 'localizable' => 0,
256 'html' => [
257 'type' => 'CheckBox',
258 ],
259 ],
260 'domain_id' => [
261 'name' => 'domain_id',
262 'type' => CRM_Utils_Type::T_INT,
263 'title' => ts('SMS Domain'),
264 'description' => 'Which Domain is this sms provider for',
265 'table_name' => 'civicrm_sms_provider',
266 'entity' => 'Provider',
267 'bao' => 'CRM_SMS_BAO_Provider',
268 'localizable' => 0,
269 'FKClassName' => 'CRM_Core_DAO_Domain',
270 'pseudoconstant' => [
271 'table' => 'civicrm_domain',
272 'keyColumn' => 'id',
273 'labelColumn' => 'name',
274 ]
275 ],
276 ];
277 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
278 }
279 return Civi::$statics[__CLASS__]['fields'];
280 }
281
282 /**
283 * Return a mapping from field-name to the corresponding key (as used in fields()).
284 *
285 * @return array
286 * Array(string $name => string $uniqueName).
287 */
288 public static function &fieldKeys() {
289 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
290 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
291 }
292 return Civi::$statics[__CLASS__]['fieldKeys'];
293 }
294
295 /**
296 * Returns the names of this table
297 *
298 * @return string
299 */
300 public static function getTableName() {
301 return self::$_tableName;
302 }
303
304 /**
305 * Returns if this table needs to be logged
306 *
307 * @return bool
308 */
309 public function getLog() {
310 return self::$_log;
311 }
312
313 /**
314 * Returns the list of fields that can be imported
315 *
316 * @param bool $prefix
317 *
318 * @return array
319 */
320 public static function &import($prefix = FALSE) {
321 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []);
322 return $r;
323 }
324
325 /**
326 * Returns the list of fields that can be exported
327 *
328 * @param bool $prefix
329 *
330 * @return array
331 */
332 public static function &export($prefix = FALSE) {
333 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []);
334 return $r;
335 }
336
337 /**
338 * Returns the list of indices
339 *
340 * @param bool $localize
341 *
342 * @return array
343 */
344 public static function indices($localize = TRUE) {
345 $indices = [];
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
347 }
348
349 }