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