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:337dd2bb4d7df6fcf7d74813e2c45bd5)
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 * @param bool $plural
122 * Whether to return the plural version of the title.
124 public static function getEntityTitle($plural = FALSE) {
125 return $plural ?
ts('Cxns') : ts('Cxn');
129 * Returns all the column names of this table
133 public static function &fields() {
134 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
135 Civi
::$statics[__CLASS__
]['fields'] = [
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Connection ID'),
140 'description' => ts('Connection ID'),
142 'where' => 'civicrm_cxn.id',
143 'table_name' => 'civicrm_cxn',
145 'bao' => 'CRM_Cxn_BAO_Cxn',
154 'name' => 'app_guid',
155 'type' => CRM_Utils_Type
::T_STRING
,
156 'title' => ts('Application GUID'),
157 'description' => ts('Application GUID'),
159 'size' => CRM_Utils_Type
::HUGE
,
160 'where' => 'civicrm_cxn.app_guid',
161 'table_name' => 'civicrm_cxn',
163 'bao' => 'CRM_Cxn_BAO_Cxn',
168 'name' => 'app_meta',
169 'type' => CRM_Utils_Type
::T_TEXT
,
170 'title' => ts('Application Metadata (JSON)'),
171 'description' => ts('Application Metadata (JSON)'),
172 'where' => 'civicrm_cxn.app_meta',
173 'table_name' => 'civicrm_cxn',
175 'bao' => 'CRM_Cxn_BAO_Cxn',
180 'name' => 'cxn_guid',
181 'type' => CRM_Utils_Type
::T_STRING
,
182 'title' => ts('Connection GUID'),
183 'description' => ts('Connection GUID'),
185 'size' => CRM_Utils_Type
::HUGE
,
186 'where' => 'civicrm_cxn.cxn_guid',
187 'table_name' => 'civicrm_cxn',
189 'bao' => 'CRM_Cxn_BAO_Cxn',
195 'type' => CRM_Utils_Type
::T_TEXT
,
196 'title' => ts('Secret'),
197 'description' => ts('Shared secret'),
198 'where' => 'civicrm_cxn.secret',
199 'table_name' => 'civicrm_cxn',
201 'bao' => 'CRM_Cxn_BAO_Cxn',
204 'label' => ts("Secret"),
210 'type' => CRM_Utils_Type
::T_TEXT
,
211 'title' => ts('Perm'),
212 'description' => ts('Permissions approved for the service (JSON)'),
213 'where' => 'civicrm_cxn.perm',
214 'table_name' => 'civicrm_cxn',
216 'bao' => 'CRM_Cxn_BAO_Cxn',
219 'label' => ts("Permissions"),
225 'type' => CRM_Utils_Type
::T_TEXT
,
226 'title' => ts('Options'),
227 'description' => ts('Options for the service (JSON)'),
228 'where' => 'civicrm_cxn.options',
229 'table_name' => 'civicrm_cxn',
231 'bao' => 'CRM_Cxn_BAO_Cxn',
233 'serialize' => self
::SERIALIZE_JSON
,
235 'label' => ts("Options"),
240 'name' => 'is_active',
241 'type' => CRM_Utils_Type
::T_BOOLEAN
,
242 'title' => ts('Is Active'),
243 'description' => ts('Is connection currently enabled?'),
244 'where' => 'civicrm_cxn.is_active',
246 'table_name' => 'civicrm_cxn',
248 'bao' => 'CRM_Cxn_BAO_Cxn',
253 'name' => 'created_date',
254 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
255 'title' => ts('Created Date'),
256 'description' => ts('When was the connection was created.'),
258 'where' => 'civicrm_cxn.created_date',
260 'table_name' => 'civicrm_cxn',
262 'bao' => 'CRM_Cxn_BAO_Cxn',
265 'label' => ts("Created Date"),
270 'name' => 'modified_date',
271 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
272 'title' => ts('Modified Date'),
273 'description' => ts('When the connection was created or modified.'),
275 'where' => 'civicrm_cxn.modified_date',
276 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
277 'table_name' => 'civicrm_cxn',
279 'bao' => 'CRM_Cxn_BAO_Cxn',
282 'label' => ts("Modified Date"),
288 'name' => 'fetched_date',
289 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
290 'title' => ts('Fetched Date'),
291 'description' => ts('The last time the application metadata was fetched.'),
293 'where' => 'civicrm_cxn.fetched_date',
295 'table_name' => 'civicrm_cxn',
297 'bao' => 'CRM_Cxn_BAO_Cxn',
300 'label' => ts("Fetched Date"),
305 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
307 return Civi
::$statics[__CLASS__
]['fields'];
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
314 * Array(string $name => string $uniqueName).
316 public static function &fieldKeys() {
317 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
318 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
320 return Civi
::$statics[__CLASS__
]['fieldKeys'];
324 * Returns the names of this table
328 public static function getTableName() {
329 return self
::$_tableName;
333 * Returns if this table needs to be logged
337 public function getLog() {
342 * Returns the list of fields that can be imported
344 * @param bool $prefix
348 public static function &import($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cxn', $prefix, []);
354 * Returns the list of fields that can be exported
356 * @param bool $prefix
360 public static function &export($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cxn', $prefix, []);
366 * Returns the list of indices
368 * @param bool $localize
372 public static function indices($localize = TRUE) {
375 'name' => 'UI_appid',
379 'localizable' => FALSE,
381 'sig' => 'civicrm_cxn::1::app_guid',
383 'UI_keypair_cxnid' => [
384 'name' => 'UI_keypair_cxnid',
388 'localizable' => FALSE,
390 'sig' => 'civicrm_cxn::1::cxn_guid',
393 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;