5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Cxn/Cxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ef4c2d6fa99ceb5d3b6cc29e78d80e42)
13 * Database access object for the Cxn entity.
15 class CRM_Cxn_DAO_Cxn
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.6';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_cxn';
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.
46 * (SQL type: varchar(128))
47 * Note that values will be retrieved from the database as a string.
52 * Application Metadata (JSON)
56 * Note that values will be retrieved from the database as a string.
64 * (SQL type: varchar(128))
65 * Note that values will be retrieved from the database as a string.
74 * Note that values will be retrieved from the database as a string.
79 * Permissions approved for the service (JSON)
83 * Note that values will be retrieved from the database as a string.
88 * Options for the service (JSON)
92 * Note that values will be retrieved from the database as a string.
97 * Is connection currently enabled?
99 * @var bool|string|null
100 * (SQL type: tinyint)
101 * Note that values will be retrieved from the database as a string.
106 * When was the connection was created.
109 * (SQL type: timestamp)
110 * Note that values will be retrieved from the database as a string.
112 public $created_date;
115 * When the connection was created or modified.
118 * (SQL type: timestamp)
119 * Note that values will be retrieved from the database as a string.
121 public $modified_date;
124 * The last time the application metadata was fetched.
127 * (SQL type: timestamp)
128 * Note that values will be retrieved from the database as a string.
130 public $fetched_date;
135 public function __construct() {
136 $this->__table
= 'civicrm_cxn';
137 parent
::__construct();
141 * Returns localized title of this entity.
143 * @param bool $plural
144 * Whether to return the plural version of the title.
146 public static function getEntityTitle($plural = FALSE) {
147 return $plural ?
ts('Cxns') : ts('Cxn');
151 * Returns all the column names of this table
155 public static function &fields() {
156 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
157 Civi
::$statics[__CLASS__
]['fields'] = [
160 'type' => CRM_Utils_Type
::T_INT
,
161 'title' => ts('Connection ID'),
162 'description' => ts('Connection ID'),
164 'where' => 'civicrm_cxn.id',
165 'table_name' => 'civicrm_cxn',
167 'bao' => 'CRM_Cxn_BAO_Cxn',
176 'name' => 'app_guid',
177 'type' => CRM_Utils_Type
::T_STRING
,
178 'title' => ts('Application GUID'),
179 'description' => ts('Application GUID'),
181 'size' => CRM_Utils_Type
::HUGE
,
182 'where' => 'civicrm_cxn.app_guid',
183 'table_name' => 'civicrm_cxn',
185 'bao' => 'CRM_Cxn_BAO_Cxn',
190 'name' => 'app_meta',
191 'type' => CRM_Utils_Type
::T_TEXT
,
192 'title' => ts('Application Metadata (JSON)'),
193 'description' => ts('Application Metadata (JSON)'),
194 'where' => 'civicrm_cxn.app_meta',
195 'table_name' => 'civicrm_cxn',
197 'bao' => 'CRM_Cxn_BAO_Cxn',
202 'name' => 'cxn_guid',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Connection GUID'),
205 'description' => ts('Connection GUID'),
207 'size' => CRM_Utils_Type
::HUGE
,
208 'where' => 'civicrm_cxn.cxn_guid',
209 'table_name' => 'civicrm_cxn',
211 'bao' => 'CRM_Cxn_BAO_Cxn',
217 'type' => CRM_Utils_Type
::T_TEXT
,
218 'title' => ts('Secret'),
219 'description' => ts('Shared secret'),
220 'where' => 'civicrm_cxn.secret',
221 'table_name' => 'civicrm_cxn',
223 'bao' => 'CRM_Cxn_BAO_Cxn',
226 'label' => ts("Secret"),
232 'type' => CRM_Utils_Type
::T_TEXT
,
233 'title' => ts('Perm'),
234 'description' => ts('Permissions approved for the service (JSON)'),
235 'where' => 'civicrm_cxn.perm',
236 'table_name' => 'civicrm_cxn',
238 'bao' => 'CRM_Cxn_BAO_Cxn',
241 'label' => ts("Permissions"),
247 'type' => CRM_Utils_Type
::T_TEXT
,
248 'title' => ts('Options'),
249 'description' => ts('Options for the service (JSON)'),
250 'where' => 'civicrm_cxn.options',
251 'table_name' => 'civicrm_cxn',
253 'bao' => 'CRM_Cxn_BAO_Cxn',
255 'serialize' => self
::SERIALIZE_JSON
,
257 'label' => ts("Options"),
262 'name' => 'is_active',
263 'type' => CRM_Utils_Type
::T_BOOLEAN
,
264 'title' => ts('Is Active'),
265 'description' => ts('Is connection currently enabled?'),
266 'where' => 'civicrm_cxn.is_active',
268 'table_name' => 'civicrm_cxn',
270 'bao' => 'CRM_Cxn_BAO_Cxn',
275 'name' => 'created_date',
276 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
277 'title' => ts('Created Date'),
278 'description' => ts('When was the connection was created.'),
280 'where' => 'civicrm_cxn.created_date',
282 'table_name' => 'civicrm_cxn',
284 'bao' => 'CRM_Cxn_BAO_Cxn',
287 'label' => ts("Created Date"),
292 'name' => 'modified_date',
293 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
294 'title' => ts('Modified Date'),
295 'description' => ts('When the connection was created or modified.'),
297 'where' => 'civicrm_cxn.modified_date',
298 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
299 'table_name' => 'civicrm_cxn',
301 'bao' => 'CRM_Cxn_BAO_Cxn',
304 'label' => ts("Modified Date"),
310 'name' => 'fetched_date',
311 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
312 'title' => ts('Fetched Date'),
313 'description' => ts('The last time the application metadata was fetched.'),
315 'where' => 'civicrm_cxn.fetched_date',
317 'table_name' => 'civicrm_cxn',
319 'bao' => 'CRM_Cxn_BAO_Cxn',
322 'label' => ts("Fetched Date"),
327 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
329 return Civi
::$statics[__CLASS__
]['fields'];
333 * Return a mapping from field-name to the corresponding key (as used in fields()).
336 * Array(string $name => string $uniqueName).
338 public static function &fieldKeys() {
339 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
340 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
342 return Civi
::$statics[__CLASS__
]['fieldKeys'];
346 * Returns the names of this table
350 public static function getTableName() {
351 return self
::$_tableName;
355 * Returns if this table needs to be logged
359 public function getLog() {
364 * Returns the list of fields that can be imported
366 * @param bool $prefix
370 public static function &import($prefix = FALSE) {
371 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cxn', $prefix, []);
376 * Returns the list of fields that can be exported
378 * @param bool $prefix
382 public static function &export($prefix = FALSE) {
383 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cxn', $prefix, []);
388 * Returns the list of indices
390 * @param bool $localize
394 public static function indices($localize = TRUE) {
397 'name' => 'UI_appid',
401 'localizable' => FALSE,
403 'sig' => 'civicrm_cxn::1::app_guid',
405 'UI_keypair_cxnid' => [
406 'name' => 'UI_keypair_cxnid',
410 'localizable' => FALSE,
412 'sig' => 'civicrm_cxn::1::cxn_guid',
415 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;