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 | |
a9d0587b | 9 | * (GenCodeChecksum:bafb13cb7901c4f15b5348e2bf9a27b5) |
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 { |
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, |
a9d0587b | 142 | 'add' => '4.6', |
c3fc2621 CW |
143 | ], |
144 | 'app_guid' => [ | |
e501603b TO |
145 | 'name' => 'app_guid', |
146 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 147 | 'title' => ts('Application GUID'), |
215b423e | 148 | 'description' => ts('Application GUID'), |
e501603b TO |
149 | 'maxlength' => 128, |
150 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 151 | 'where' => 'civicrm_cxn.app_guid', |
522a26c9 | 152 | 'table_name' => 'civicrm_cxn', |
153 | 'entity' => 'Cxn', | |
154 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 155 | 'localizable' => 0, |
a9d0587b | 156 | 'add' => '4.6', |
c3fc2621 CW |
157 | ], |
158 | 'app_meta' => [ | |
e501603b TO |
159 | 'name' => 'app_meta', |
160 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 161 | 'title' => ts('Application Metadata (JSON)'), |
215b423e | 162 | 'description' => ts('Application Metadata (JSON)'), |
a36434b9 | 163 | 'where' => 'civicrm_cxn.app_meta', |
522a26c9 | 164 | 'table_name' => 'civicrm_cxn', |
165 | 'entity' => 'Cxn', | |
166 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 167 | 'localizable' => 0, |
a9d0587b | 168 | 'add' => '4.6', |
c3fc2621 CW |
169 | ], |
170 | 'cxn_guid' => [ | |
e501603b TO |
171 | 'name' => 'cxn_guid', |
172 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 173 | 'title' => ts('Connection GUID'), |
215b423e | 174 | 'description' => ts('Connection GUID'), |
e501603b TO |
175 | 'maxlength' => 128, |
176 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 177 | 'where' => 'civicrm_cxn.cxn_guid', |
522a26c9 | 178 | 'table_name' => 'civicrm_cxn', |
179 | 'entity' => 'Cxn', | |
180 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 181 | 'localizable' => 0, |
a9d0587b | 182 | 'add' => '4.6', |
c3fc2621 CW |
183 | ], |
184 | 'secret' => [ | |
e501603b TO |
185 | 'name' => 'secret', |
186 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 187 | 'title' => ts('Secret'), |
215b423e | 188 | 'description' => ts('Shared secret'), |
a36434b9 | 189 | 'where' => 'civicrm_cxn.secret', |
522a26c9 | 190 | 'table_name' => 'civicrm_cxn', |
191 | 'entity' => 'Cxn', | |
192 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 193 | 'localizable' => 0, |
a9d0587b | 194 | 'add' => '4.6', |
c3fc2621 CW |
195 | ], |
196 | 'perm' => [ | |
e501603b TO |
197 | 'name' => 'perm', |
198 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 199 | 'title' => ts('Perm'), |
215b423e | 200 | 'description' => ts('Permissions approved for the service (JSON)'), |
a36434b9 | 201 | 'where' => 'civicrm_cxn.perm', |
522a26c9 | 202 | 'table_name' => 'civicrm_cxn', |
203 | 'entity' => 'Cxn', | |
204 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 205 | 'localizable' => 0, |
a9d0587b | 206 | 'add' => '4.6', |
c3fc2621 CW |
207 | ], |
208 | 'options' => [ | |
e501603b TO |
209 | 'name' => 'options', |
210 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 211 | 'title' => ts('Options'), |
215b423e | 212 | 'description' => ts('Options for the service (JSON)'), |
a36434b9 | 213 | 'where' => 'civicrm_cxn.options', |
522a26c9 | 214 | 'table_name' => 'civicrm_cxn', |
215 | 'entity' => 'Cxn', | |
216 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 217 | 'localizable' => 0, |
d0127d84 | 218 | 'serialize' => self::SERIALIZE_JSON, |
a9d0587b | 219 | 'add' => '4.6', |
c3fc2621 CW |
220 | ], |
221 | 'is_active' => [ | |
e501603b TO |
222 | 'name' => 'is_active', |
223 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 224 | 'title' => ts('Is Active'), |
215b423e | 225 | 'description' => ts('Is connection currently enabled?'), |
a36434b9 | 226 | 'where' => 'civicrm_cxn.is_active', |
e501603b | 227 | 'default' => '1', |
522a26c9 | 228 | 'table_name' => 'civicrm_cxn', |
229 | 'entity' => 'Cxn', | |
230 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 231 | 'localizable' => 0, |
a9d0587b | 232 | 'add' => '4.6', |
c3fc2621 CW |
233 | ], |
234 | 'created_date' => [ | |
e501603b TO |
235 | 'name' => 'created_date', |
236 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 237 | 'title' => ts('Created Date'), |
215b423e | 238 | 'description' => ts('When was the connection was created.'), |
c3fc2621 | 239 | 'required' => FALSE, |
a36434b9 | 240 | 'where' => 'civicrm_cxn.created_date', |
e501603b | 241 | 'default' => 'NULL', |
522a26c9 | 242 | 'table_name' => 'civicrm_cxn', |
243 | 'entity' => 'Cxn', | |
244 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 245 | 'localizable' => 0, |
a9d0587b | 246 | 'add' => '4.6', |
c3fc2621 CW |
247 | ], |
248 | 'modified_date' => [ | |
e501603b TO |
249 | 'name' => 'modified_date', |
250 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 251 | 'title' => ts('Modified Date'), |
215b423e | 252 | 'description' => ts('When the connection was created or modified.'), |
c3fc2621 | 253 | 'required' => FALSE, |
a36434b9 | 254 | 'where' => 'civicrm_cxn.modified_date', |
e501603b | 255 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', |
522a26c9 | 256 | 'table_name' => 'civicrm_cxn', |
257 | 'entity' => 'Cxn', | |
258 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 259 | 'localizable' => 0, |
a9d0587b | 260 | 'add' => '4.6', |
c3fc2621 CW |
261 | ], |
262 | 'fetched_date' => [ | |
e501603b TO |
263 | 'name' => 'fetched_date', |
264 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 265 | 'title' => ts('Fetched Date'), |
215b423e | 266 | 'description' => ts('The last time the application metadata was fetched.'), |
c3fc2621 | 267 | 'required' => FALSE, |
a36434b9 | 268 | 'where' => 'civicrm_cxn.fetched_date', |
e501603b | 269 | 'default' => 'NULL', |
522a26c9 | 270 | 'table_name' => 'civicrm_cxn', |
271 | 'entity' => 'Cxn', | |
272 | 'bao' => 'CRM_Cxn_BAO_Cxn', | |
6a7e5e5d | 273 | 'localizable' => 0, |
a9d0587b | 274 | 'add' => '4.6', |
c3fc2621 CW |
275 | ], |
276 | ]; | |
346aaaba | 277 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 278 | } |
346aaaba | 279 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 280 | } |
c3fc2621 | 281 | |
e501603b | 282 | /** |
bd8e0b14 | 283 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
284 | * |
285 | * @return array | |
bd8e0b14 | 286 | * Array(string $name => string $uniqueName). |
e501603b | 287 | */ |
c3fc2621 | 288 | public static function &fieldKeys() { |
bd8e0b14 TO |
289 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
290 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 291 | } |
bd8e0b14 | 292 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 293 | } |
c3fc2621 | 294 | |
e501603b TO |
295 | /** |
296 | * Returns the names of this table | |
297 | * | |
298 | * @return string | |
299 | */ | |
c3fc2621 | 300 | public static function getTableName() { |
e501603b TO |
301 | return self::$_tableName; |
302 | } | |
c3fc2621 | 303 | |
e501603b TO |
304 | /** |
305 | * Returns if this table needs to be logged | |
306 | * | |
c3fc2621 | 307 | * @return bool |
e501603b | 308 | */ |
c3fc2621 | 309 | public function getLog() { |
e501603b TO |
310 | return self::$_log; |
311 | } | |
c3fc2621 | 312 | |
e501603b TO |
313 | /** |
314 | * Returns the list of fields that can be imported | |
315 | * | |
316 | * @param bool $prefix | |
317 | * | |
318 | * @return array | |
319 | */ | |
c3fc2621 CW |
320 | public static function &import($prefix = FALSE) { |
321 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, []); | |
60808919 | 322 | return $r; |
e501603b | 323 | } |
c3fc2621 | 324 | |
e501603b TO |
325 | /** |
326 | * Returns the list of fields that can be exported | |
327 | * | |
328 | * @param bool $prefix | |
329 | * | |
330 | * @return array | |
331 | */ | |
c3fc2621 CW |
332 | public static function &export($prefix = FALSE) { |
333 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, []); | |
60808919 | 334 | return $r; |
e501603b | 335 | } |
c3fc2621 | 336 | |
e7a6b91a AS |
337 | /** |
338 | * Returns the list of indices | |
c3fc2621 CW |
339 | * |
340 | * @param bool $localize | |
341 | * | |
342 | * @return array | |
e7a6b91a AS |
343 | */ |
344 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
345 | $indices = [ |
346 | 'UI_appid' => [ | |
e7a6b91a | 347 | 'name' => 'UI_appid', |
c3fc2621 | 348 | 'field' => [ |
e7a6b91a | 349 | 0 => 'app_guid', |
c3fc2621 CW |
350 | ], |
351 | 'localizable' => FALSE, | |
352 | 'unique' => TRUE, | |
e7a6b91a | 353 | 'sig' => 'civicrm_cxn::1::app_guid', |
c3fc2621 CW |
354 | ], |
355 | 'UI_keypair_cxnid' => [ | |
e7a6b91a | 356 | 'name' => 'UI_keypair_cxnid', |
c3fc2621 | 357 | 'field' => [ |
e7a6b91a | 358 | 0 => 'cxn_guid', |
c3fc2621 CW |
359 | ], |
360 | 'localizable' => FALSE, | |
361 | 'unique' => TRUE, | |
e7a6b91a | 362 | 'sig' => 'civicrm_cxn::1::cxn_guid', |
c3fc2621 CW |
363 | ], |
364 | ]; | |
e7a6b91a AS |
365 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
366 | } | |
c3fc2621 | 367 | |
e501603b | 368 | } |