Merge pull request #17440 from eileenmcnaughton/log_summ
[civicrm-core.git] / CRM / Cxn / DAO / Cxn.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Cxn/Cxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:efa483cd4f17b2ff7c7444dd888b2369)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Cxn entity.
f41f0342 14 */
e501603b 15class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_cxn';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Connection ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Application GUID
40 *
41 * @var string
42 */
43 public $app_guid;
c3fc2621 44
e501603b
TO
45 /**
46 * Application Metadata (JSON)
47 *
48 * @var text
49 */
50 public $app_meta;
c3fc2621 51
e501603b
TO
52 /**
53 * Connection GUID
54 *
55 * @var string
56 */
57 public $cxn_guid;
c3fc2621 58
e501603b
TO
59 /**
60 * Shared secret
61 *
62 * @var text
63 */
64 public $secret;
c3fc2621 65
e501603b
TO
66 /**
67 * Permissions approved for the service (JSON)
68 *
69 * @var text
70 */
71 public $perm;
c3fc2621 72
e501603b
TO
73 /**
74 * Options for the service (JSON)
75 *
76 * @var text
77 */
78 public $options;
c3fc2621 79
e501603b
TO
80 /**
81 * Is connection currently enabled?
82 *
e6ca0a57 83 * @var bool
e501603b
TO
84 */
85 public $is_active;
c3fc2621 86
e501603b
TO
87 /**
88 * When was the connection was created.
89 *
90 * @var timestamp
91 */
92 public $created_date;
c3fc2621 93
e501603b
TO
94 /**
95 * When the connection was created or modified.
96 *
97 * @var timestamp
98 */
99 public $modified_date;
c3fc2621 100
e501603b
TO
101 /**
102 * The last time the application metadata was fetched.
103 *
104 * @var timestamp
105 */
106 public $fetched_date;
c3fc2621 107
e501603b 108 /**
f41f0342 109 * Class constructor.
e501603b 110 */
c3fc2621 111 public function __construct() {
e501603b
TO
112 $this->__table = 'civicrm_cxn';
113 parent::__construct();
114 }
c3fc2621 115
449c4e6b
CW
116 /**
117 * Returns localized title of this entity.
118 */
119 public static function getEntityTitle() {
120 return ts('Cxns');
121 }
122
e501603b
TO
123 /**
124 * Returns all the column names of this table
125 *
126 * @return array
127 */
c3fc2621 128 public static function &fields() {
346aaaba 129 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
130 Civi::$statics[__CLASS__]['fields'] = [
131 'id' => [
e501603b
TO
132 'name' => 'id',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621 134 'title' => ts('Connection ID'),
215b423e 135 'description' => ts('Connection ID'),
c3fc2621 136 'required' => TRUE,
a36434b9 137 'where' => 'civicrm_cxn.id',
522a26c9 138 'table_name' => 'civicrm_cxn',
139 'entity' => 'Cxn',
140 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 141 'localizable' => 0,
c3fc2621
CW
142 ],
143 'app_guid' => [
e501603b
TO
144 'name' => 'app_guid',
145 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 146 'title' => ts('Application GUID'),
215b423e 147 'description' => ts('Application GUID'),
e501603b
TO
148 'maxlength' => 128,
149 'size' => CRM_Utils_Type::HUGE,
a36434b9 150 'where' => 'civicrm_cxn.app_guid',
522a26c9 151 'table_name' => 'civicrm_cxn',
152 'entity' => 'Cxn',
153 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 154 'localizable' => 0,
c3fc2621
CW
155 ],
156 'app_meta' => [
e501603b
TO
157 'name' => 'app_meta',
158 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 159 'title' => ts('Application Metadata (JSON)'),
215b423e 160 'description' => ts('Application Metadata (JSON)'),
a36434b9 161 'where' => 'civicrm_cxn.app_meta',
522a26c9 162 'table_name' => 'civicrm_cxn',
163 'entity' => 'Cxn',
164 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 165 'localizable' => 0,
c3fc2621
CW
166 ],
167 'cxn_guid' => [
e501603b
TO
168 'name' => 'cxn_guid',
169 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 170 'title' => ts('Connection GUID'),
215b423e 171 'description' => ts('Connection GUID'),
e501603b
TO
172 'maxlength' => 128,
173 'size' => CRM_Utils_Type::HUGE,
a36434b9 174 'where' => 'civicrm_cxn.cxn_guid',
522a26c9 175 'table_name' => 'civicrm_cxn',
176 'entity' => 'Cxn',
177 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 178 'localizable' => 0,
c3fc2621
CW
179 ],
180 'secret' => [
e501603b
TO
181 'name' => 'secret',
182 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 183 'title' => ts('Secret'),
215b423e 184 'description' => ts('Shared secret'),
a36434b9 185 'where' => 'civicrm_cxn.secret',
522a26c9 186 'table_name' => 'civicrm_cxn',
187 'entity' => 'Cxn',
188 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 189 'localizable' => 0,
c3fc2621
CW
190 ],
191 'perm' => [
e501603b
TO
192 'name' => 'perm',
193 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 194 'title' => ts('Perm'),
215b423e 195 'description' => ts('Permissions approved for the service (JSON)'),
a36434b9 196 'where' => 'civicrm_cxn.perm',
522a26c9 197 'table_name' => 'civicrm_cxn',
198 'entity' => 'Cxn',
199 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 200 'localizable' => 0,
c3fc2621
CW
201 ],
202 'options' => [
e501603b
TO
203 'name' => 'options',
204 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 205 'title' => ts('Options'),
215b423e 206 'description' => ts('Options for the service (JSON)'),
a36434b9 207 'where' => 'civicrm_cxn.options',
522a26c9 208 'table_name' => 'civicrm_cxn',
209 'entity' => 'Cxn',
210 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 211 'localizable' => 0,
d0127d84 212 'serialize' => self::SERIALIZE_JSON,
c3fc2621
CW
213 ],
214 'is_active' => [
e501603b
TO
215 'name' => 'is_active',
216 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 217 'title' => ts('Is Active'),
215b423e 218 'description' => ts('Is connection currently enabled?'),
a36434b9 219 'where' => 'civicrm_cxn.is_active',
e501603b 220 'default' => '1',
522a26c9 221 'table_name' => 'civicrm_cxn',
222 'entity' => 'Cxn',
223 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 224 'localizable' => 0,
c3fc2621
CW
225 ],
226 'created_date' => [
e501603b
TO
227 'name' => 'created_date',
228 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 229 'title' => ts('Created Date'),
215b423e 230 'description' => ts('When was the connection was created.'),
c3fc2621 231 'required' => FALSE,
a36434b9 232 'where' => 'civicrm_cxn.created_date',
e501603b 233 'default' => 'NULL',
522a26c9 234 'table_name' => 'civicrm_cxn',
235 'entity' => 'Cxn',
236 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 237 'localizable' => 0,
c3fc2621
CW
238 ],
239 'modified_date' => [
e501603b
TO
240 'name' => 'modified_date',
241 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 242 'title' => ts('Modified Date'),
215b423e 243 'description' => ts('When the connection was created or modified.'),
c3fc2621 244 'required' => FALSE,
a36434b9 245 'where' => 'civicrm_cxn.modified_date',
e501603b 246 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 247 'table_name' => 'civicrm_cxn',
248 'entity' => 'Cxn',
249 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 250 'localizable' => 0,
c3fc2621
CW
251 ],
252 'fetched_date' => [
e501603b
TO
253 'name' => 'fetched_date',
254 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 255 'title' => ts('Fetched Date'),
215b423e 256 'description' => ts('The last time the application metadata was fetched.'),
c3fc2621 257 'required' => FALSE,
a36434b9 258 'where' => 'civicrm_cxn.fetched_date',
e501603b 259 'default' => 'NULL',
522a26c9 260 'table_name' => 'civicrm_cxn',
261 'entity' => 'Cxn',
262 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 263 'localizable' => 0,
c3fc2621
CW
264 ],
265 ];
346aaaba 266 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 267 }
346aaaba 268 return Civi::$statics[__CLASS__]['fields'];
e501603b 269 }
c3fc2621 270
e501603b 271 /**
bd8e0b14 272 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
273 *
274 * @return array
bd8e0b14 275 * Array(string $name => string $uniqueName).
e501603b 276 */
c3fc2621 277 public static function &fieldKeys() {
bd8e0b14
TO
278 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
279 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 280 }
bd8e0b14 281 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 282 }
c3fc2621 283
e501603b
TO
284 /**
285 * Returns the names of this table
286 *
287 * @return string
288 */
c3fc2621 289 public static function getTableName() {
e501603b
TO
290 return self::$_tableName;
291 }
c3fc2621 292
e501603b
TO
293 /**
294 * Returns if this table needs to be logged
295 *
c3fc2621 296 * @return bool
e501603b 297 */
c3fc2621 298 public function getLog() {
e501603b
TO
299 return self::$_log;
300 }
c3fc2621 301
e501603b
TO
302 /**
303 * Returns the list of fields that can be imported
304 *
305 * @param bool $prefix
306 *
307 * @return array
308 */
c3fc2621
CW
309 public static function &import($prefix = FALSE) {
310 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, []);
60808919 311 return $r;
e501603b 312 }
c3fc2621 313
e501603b
TO
314 /**
315 * Returns the list of fields that can be exported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
c3fc2621
CW
321 public static function &export($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, []);
60808919 323 return $r;
e501603b 324 }
c3fc2621 325
e7a6b91a
AS
326 /**
327 * Returns the list of indices
c3fc2621
CW
328 *
329 * @param bool $localize
330 *
331 * @return array
e7a6b91a
AS
332 */
333 public static function indices($localize = TRUE) {
c3fc2621
CW
334 $indices = [
335 'UI_appid' => [
e7a6b91a 336 'name' => 'UI_appid',
c3fc2621 337 'field' => [
e7a6b91a 338 0 => 'app_guid',
c3fc2621
CW
339 ],
340 'localizable' => FALSE,
341 'unique' => TRUE,
e7a6b91a 342 'sig' => 'civicrm_cxn::1::app_guid',
c3fc2621
CW
343 ],
344 'UI_keypair_cxnid' => [
e7a6b91a 345 'name' => 'UI_keypair_cxnid',
c3fc2621 346 'field' => [
e7a6b91a 347 0 => 'cxn_guid',
c3fc2621
CW
348 ],
349 'localizable' => FALSE,
350 'unique' => TRUE,
e7a6b91a 351 'sig' => 'civicrm_cxn::1::cxn_guid',
c3fc2621
CW
352 ],
353 ];
e7a6b91a
AS
354 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
355 }
c3fc2621 356
e501603b 357}