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:059dd4994211085d728a9fc8b7d80803)
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;
48 * Application Metadata (JSON)
69 * Permissions approved for the service (JSON)
76 * Options for the service (JSON)
83 * Is connection currently enabled?
90 * When was the connection was created.
97 * When the connection was created or modified.
101 public $modified_date;
104 * The last time the application metadata was fetched.
108 public $fetched_date;
113 public function __construct() {
114 $this->__table
= 'civicrm_cxn';
115 parent
::__construct();
119 * Returns localized title of this entity.
121 public static function getEntityTitle() {
126 * Returns all the column names of this table
130 public static function &fields() {
131 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
132 Civi
::$statics[__CLASS__
]['fields'] = [
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Connection ID'),
137 'description' => ts('Connection ID'),
139 'where' => 'civicrm_cxn.id',
140 'table_name' => 'civicrm_cxn',
142 'bao' => 'CRM_Cxn_BAO_Cxn',
147 'name' => 'app_guid',
148 'type' => CRM_Utils_Type
::T_STRING
,
149 'title' => ts('Application GUID'),
150 'description' => ts('Application GUID'),
152 'size' => CRM_Utils_Type
::HUGE
,
153 'where' => 'civicrm_cxn.app_guid',
154 'table_name' => 'civicrm_cxn',
156 'bao' => 'CRM_Cxn_BAO_Cxn',
161 'name' => 'app_meta',
162 'type' => CRM_Utils_Type
::T_TEXT
,
163 'title' => ts('Application Metadata (JSON)'),
164 'description' => ts('Application Metadata (JSON)'),
165 'where' => 'civicrm_cxn.app_meta',
166 'table_name' => 'civicrm_cxn',
168 'bao' => 'CRM_Cxn_BAO_Cxn',
173 'name' => 'cxn_guid',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Connection GUID'),
176 'description' => ts('Connection GUID'),
178 'size' => CRM_Utils_Type
::HUGE
,
179 'where' => 'civicrm_cxn.cxn_guid',
180 'table_name' => 'civicrm_cxn',
182 'bao' => 'CRM_Cxn_BAO_Cxn',
188 'type' => CRM_Utils_Type
::T_TEXT
,
189 'title' => ts('Secret'),
190 'description' => ts('Shared secret'),
191 'where' => 'civicrm_cxn.secret',
192 'table_name' => 'civicrm_cxn',
194 'bao' => 'CRM_Cxn_BAO_Cxn',
200 'type' => CRM_Utils_Type
::T_TEXT
,
201 'title' => ts('Perm'),
202 'description' => ts('Permissions approved for the service (JSON)'),
203 'where' => 'civicrm_cxn.perm',
204 'table_name' => 'civicrm_cxn',
206 'bao' => 'CRM_Cxn_BAO_Cxn',
212 'type' => CRM_Utils_Type
::T_TEXT
,
213 'title' => ts('Options'),
214 'description' => ts('Options for the service (JSON)'),
215 'where' => 'civicrm_cxn.options',
216 'table_name' => 'civicrm_cxn',
218 'bao' => 'CRM_Cxn_BAO_Cxn',
220 'serialize' => self
::SERIALIZE_JSON
,
224 'name' => 'is_active',
225 'type' => CRM_Utils_Type
::T_BOOLEAN
,
226 'title' => ts('Is Active'),
227 'description' => ts('Is connection currently enabled?'),
228 'where' => 'civicrm_cxn.is_active',
230 'table_name' => 'civicrm_cxn',
232 'bao' => 'CRM_Cxn_BAO_Cxn',
237 'name' => 'created_date',
238 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
239 'title' => ts('Created Date'),
240 'description' => ts('When was the connection was created.'),
242 'where' => 'civicrm_cxn.created_date',
244 'table_name' => 'civicrm_cxn',
246 'bao' => 'CRM_Cxn_BAO_Cxn',
251 'name' => 'modified_date',
252 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
253 'title' => ts('Modified Date'),
254 'description' => ts('When the connection was created or modified.'),
256 'where' => 'civicrm_cxn.modified_date',
257 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
258 'table_name' => 'civicrm_cxn',
260 'bao' => 'CRM_Cxn_BAO_Cxn',
265 'name' => 'fetched_date',
266 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
267 'title' => ts('Fetched Date'),
268 'description' => ts('The last time the application metadata was fetched.'),
270 'where' => 'civicrm_cxn.fetched_date',
272 'table_name' => 'civicrm_cxn',
274 'bao' => 'CRM_Cxn_BAO_Cxn',
279 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
281 return Civi
::$statics[__CLASS__
]['fields'];
285 * Return a mapping from field-name to the corresponding key (as used in fields()).
288 * Array(string $name => string $uniqueName).
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()));
294 return Civi
::$statics[__CLASS__
]['fieldKeys'];
298 * Returns the names of this table
302 public static function getTableName() {
303 return self
::$_tableName;
307 * Returns if this table needs to be logged
311 public function getLog() {
316 * Returns the list of fields that can be imported
318 * @param bool $prefix
322 public static function &import($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cxn', $prefix, []);
328 * Returns the list of fields that can be exported
330 * @param bool $prefix
334 public static function &export($prefix = FALSE) {
335 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cxn', $prefix, []);
340 * Returns the list of indices
342 * @param bool $localize
346 public static function indices($localize = TRUE) {
349 'name' => 'UI_appid',
353 'localizable' => FALSE,
355 'sig' => 'civicrm_cxn::1::app_guid',
357 'UI_keypair_cxnid' => [
358 'name' => 'UI_keypair_cxnid',
362 'localizable' => FALSE,
364 'sig' => 'civicrm_cxn::1::cxn_guid',
367 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;