5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/SMS/Provider.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:77bb8b25b596507446974d9dd3bd4c8e)
13 * Database access object for the Provider entity.
15 class CRM_SMS_DAO_Provider
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_sms_provider';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Provider internal name points to option_value of option_group sms_provider_name
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
52 * Provider name visible to user
55 * (SQL type: varchar(64))
56 * Note that values will be retrieved from the database as a string.
62 * (SQL type: varchar(255))
63 * Note that values will be retrieved from the database as a string.
69 * (SQL type: varchar(255))
70 * Note that values will be retrieved from the database as a string.
75 * points to value in civicrm_option_value for group sms_api_type
78 * (SQL type: int unsigned)
79 * Note that values will be retrieved from the database as a string.
85 * (SQL type: varchar(128))
86 * Note that values will be retrieved from the database as a string.
91 * the api params in xml, http or smtp format
95 * Note that values will be retrieved from the database as a string.
101 * (SQL type: tinyint)
102 * Note that values will be retrieved from the database as a string.
108 * (SQL type: tinyint)
109 * Note that values will be retrieved from the database as a string.
114 * Which Domain is this sms provider for
116 * @var int|string|null
117 * (SQL type: int unsigned)
118 * Note that values will be retrieved from the database as a string.
125 public function __construct() {
126 $this->__table
= 'civicrm_sms_provider';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 * @param bool $plural
134 * Whether to return the plural version of the title.
136 public static function getEntityTitle($plural = FALSE) {
137 return $plural ?
ts('Providers') : ts('Provider');
141 * Returns foreign keys and entity references.
144 * [CRM_Core_Reference_Interface]
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']);
152 return Civi
::$statics[__CLASS__
]['links'];
156 * Returns all the column names of this table
160 public static function &fields() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
162 Civi
::$statics[__CLASS__
]['fields'] = [
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('SMS Provider ID'),
167 'description' => ts('SMS Provider ID'),
169 'where' => 'civicrm_sms_provider.id',
170 'table_name' => 'civicrm_sms_provider',
171 'entity' => 'Provider',
172 'bao' => 'CRM_SMS_BAO_Provider',
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'),
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',
196 'type' => CRM_Utils_Type
::T_STRING
,
197 'title' => ts('SMS Provider Title'),
198 'description' => ts('Provider name visible to user'),
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',
212 'name' => 'username',
213 'type' => CRM_Utils_Type
::T_STRING
,
214 'title' => ts('SMS Provider Username'),
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',
228 'name' => 'password',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('SMS Provider Password'),
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',
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'),
249 'where' => 'civicrm_sms_provider.api_type',
250 'table_name' => 'civicrm_sms_provider',
251 'entity' => 'Provider',
252 'bao' => 'CRM_SMS_BAO_Provider',
257 'pseudoconstant' => [
258 'optionGroupName' => 'sms_api_type',
259 'optionEditPath' => 'civicrm/admin/options/sms_api_type',
265 'type' => CRM_Utils_Type
::T_STRING
,
266 'title' => ts('SMS Provider API URL'),
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',
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',
295 'name' => 'is_default',
296 'type' => CRM_Utils_Type
::T_BOOLEAN
,
297 'title' => ts('SMS Provider is Default?'),
299 'where' => 'civicrm_sms_provider.is_default',
301 'table_name' => 'civicrm_sms_provider',
302 'entity' => 'Provider',
303 'bao' => 'CRM_SMS_BAO_Provider',
306 'type' => 'CheckBox',
311 'name' => 'is_active',
312 'type' => CRM_Utils_Type
::T_BOOLEAN
,
313 'title' => ts('SMS Provider is Active?'),
315 'where' => 'civicrm_sms_provider.is_active',
317 'table_name' => 'civicrm_sms_provider',
318 'entity' => 'Provider',
319 'bao' => 'CRM_SMS_BAO_Provider',
322 'type' => 'CheckBox',
327 'name' => 'domain_id',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Domain ID'),
330 'description' => ts('Which Domain is this sms provider for'),
331 'where' => 'civicrm_sms_provider.domain_id',
332 'table_name' => 'civicrm_sms_provider',
333 'entity' => 'Provider',
334 'bao' => 'CRM_SMS_BAO_Provider',
336 'FKClassName' => 'CRM_Core_DAO_Domain',
338 'label' => ts("Domain"),
340 'pseudoconstant' => [
341 'table' => 'civicrm_domain',
343 'labelColumn' => 'name',
348 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
350 return Civi
::$statics[__CLASS__
]['fields'];
354 * Return a mapping from field-name to the corresponding key (as used in fields()).
357 * Array(string $name => string $uniqueName).
359 public static function &fieldKeys() {
360 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
361 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
363 return Civi
::$statics[__CLASS__
]['fieldKeys'];
367 * Returns the names of this table
371 public static function getTableName() {
372 return self
::$_tableName;
376 * Returns if this table needs to be logged
380 public function getLog() {
385 * Returns the list of fields that can be imported
387 * @param bool $prefix
391 public static function &import($prefix = FALSE) {
392 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'sms_provider', $prefix, []);
397 * Returns the list of fields that can be exported
399 * @param bool $prefix
403 public static function &export($prefix = FALSE) {
404 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'sms_provider', $prefix, []);
409 * Returns the list of indices
411 * @param bool $localize
415 public static function indices($localize = TRUE) {
417 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;