Merge pull request #20622 from eileenmcnaughton/act2
[civicrm-core.git] / CRM / Cxn / DAO / Cxn.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Cxn/Cxn.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:337dd2bb4d7df6fcf7d74813e2c45bd5)
10 */
11
12 /**
13 * Database access object for the Cxn entity.
14 */
15 class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.6';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_cxn';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Connection ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Application GUID
42 *
43 * @var string
44 */
45 public $app_guid;
46
47 /**
48 * Application Metadata (JSON)
49 *
50 * @var text
51 */
52 public $app_meta;
53
54 /**
55 * Connection GUID
56 *
57 * @var string
58 */
59 public $cxn_guid;
60
61 /**
62 * Shared secret
63 *
64 * @var text
65 */
66 public $secret;
67
68 /**
69 * Permissions approved for the service (JSON)
70 *
71 * @var text
72 */
73 public $perm;
74
75 /**
76 * Options for the service (JSON)
77 *
78 * @var text
79 */
80 public $options;
81
82 /**
83 * Is connection currently enabled?
84 *
85 * @var bool
86 */
87 public $is_active;
88
89 /**
90 * When was the connection was created.
91 *
92 * @var timestamp
93 */
94 public $created_date;
95
96 /**
97 * When the connection was created or modified.
98 *
99 * @var timestamp
100 */
101 public $modified_date;
102
103 /**
104 * The last time the application metadata was fetched.
105 *
106 * @var timestamp
107 */
108 public $fetched_date;
109
110 /**
111 * Class constructor.
112 */
113 public function __construct() {
114 $this->__table = 'civicrm_cxn';
115 parent::__construct();
116 }
117
118 /**
119 * Returns localized title of this entity.
120 *
121 * @param bool $plural
122 * Whether to return the plural version of the title.
123 */
124 public static function getEntityTitle($plural = FALSE) {
125 return $plural ? ts('Cxns') : ts('Cxn');
126 }
127
128 /**
129 * Returns all the column names of this table
130 *
131 * @return array
132 */
133 public static function &fields() {
134 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
135 Civi::$statics[__CLASS__]['fields'] = [
136 'id' => [
137 'name' => 'id',
138 'type' => CRM_Utils_Type::T_INT,
139 'title' => ts('Connection ID'),
140 'description' => ts('Connection ID'),
141 'required' => TRUE,
142 'where' => 'civicrm_cxn.id',
143 'table_name' => 'civicrm_cxn',
144 'entity' => 'Cxn',
145 'bao' => 'CRM_Cxn_BAO_Cxn',
146 'localizable' => 0,
147 'html' => [
148 'type' => 'Number',
149 ],
150 'readonly' => TRUE,
151 'add' => '4.6',
152 ],
153 'app_guid' => [
154 'name' => 'app_guid',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Application GUID'),
157 'description' => ts('Application GUID'),
158 'maxlength' => 128,
159 'size' => CRM_Utils_Type::HUGE,
160 'where' => 'civicrm_cxn.app_guid',
161 'table_name' => 'civicrm_cxn',
162 'entity' => 'Cxn',
163 'bao' => 'CRM_Cxn_BAO_Cxn',
164 'localizable' => 0,
165 'add' => '4.6',
166 ],
167 'app_meta' => [
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',
174 'entity' => 'Cxn',
175 'bao' => 'CRM_Cxn_BAO_Cxn',
176 'localizable' => 0,
177 'add' => '4.6',
178 ],
179 'cxn_guid' => [
180 'name' => 'cxn_guid',
181 'type' => CRM_Utils_Type::T_STRING,
182 'title' => ts('Connection GUID'),
183 'description' => ts('Connection GUID'),
184 'maxlength' => 128,
185 'size' => CRM_Utils_Type::HUGE,
186 'where' => 'civicrm_cxn.cxn_guid',
187 'table_name' => 'civicrm_cxn',
188 'entity' => 'Cxn',
189 'bao' => 'CRM_Cxn_BAO_Cxn',
190 'localizable' => 0,
191 'add' => '4.6',
192 ],
193 'secret' => [
194 'name' => 'secret',
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',
200 'entity' => 'Cxn',
201 'bao' => 'CRM_Cxn_BAO_Cxn',
202 'localizable' => 0,
203 'html' => [
204 'label' => ts("Secret"),
205 ],
206 'add' => '4.6',
207 ],
208 'perm' => [
209 'name' => 'perm',
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',
215 'entity' => 'Cxn',
216 'bao' => 'CRM_Cxn_BAO_Cxn',
217 'localizable' => 0,
218 'html' => [
219 'label' => ts("Permissions"),
220 ],
221 'add' => '4.6',
222 ],
223 'options' => [
224 'name' => 'options',
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',
230 'entity' => 'Cxn',
231 'bao' => 'CRM_Cxn_BAO_Cxn',
232 'localizable' => 0,
233 'serialize' => self::SERIALIZE_JSON,
234 'html' => [
235 'label' => ts("Options"),
236 ],
237 'add' => '4.6',
238 ],
239 'is_active' => [
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',
245 'default' => '1',
246 'table_name' => 'civicrm_cxn',
247 'entity' => 'Cxn',
248 'bao' => 'CRM_Cxn_BAO_Cxn',
249 'localizable' => 0,
250 'add' => '4.6',
251 ],
252 'created_date' => [
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.'),
257 'required' => FALSE,
258 'where' => 'civicrm_cxn.created_date',
259 'default' => 'NULL',
260 'table_name' => 'civicrm_cxn',
261 'entity' => 'Cxn',
262 'bao' => 'CRM_Cxn_BAO_Cxn',
263 'localizable' => 0,
264 'html' => [
265 'label' => ts("Created Date"),
266 ],
267 'add' => '4.6',
268 ],
269 'modified_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.'),
274 'required' => FALSE,
275 'where' => 'civicrm_cxn.modified_date',
276 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
277 'table_name' => 'civicrm_cxn',
278 'entity' => 'Cxn',
279 'bao' => 'CRM_Cxn_BAO_Cxn',
280 'localizable' => 0,
281 'html' => [
282 'label' => ts("Modified Date"),
283 ],
284 'readonly' => TRUE,
285 'add' => '4.6',
286 ],
287 'fetched_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.'),
292 'required' => FALSE,
293 'where' => 'civicrm_cxn.fetched_date',
294 'default' => 'NULL',
295 'table_name' => 'civicrm_cxn',
296 'entity' => 'Cxn',
297 'bao' => 'CRM_Cxn_BAO_Cxn',
298 'localizable' => 0,
299 'html' => [
300 'label' => ts("Fetched Date"),
301 ],
302 'add' => '4.6',
303 ],
304 ];
305 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
306 }
307 return Civi::$statics[__CLASS__]['fields'];
308 }
309
310 /**
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
312 *
313 * @return array
314 * Array(string $name => string $uniqueName).
315 */
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()));
319 }
320 return Civi::$statics[__CLASS__]['fieldKeys'];
321 }
322
323 /**
324 * Returns the names of this table
325 *
326 * @return string
327 */
328 public static function getTableName() {
329 return self::$_tableName;
330 }
331
332 /**
333 * Returns if this table needs to be logged
334 *
335 * @return bool
336 */
337 public function getLog() {
338 return self::$_log;
339 }
340
341 /**
342 * Returns the list of fields that can be imported
343 *
344 * @param bool $prefix
345 *
346 * @return array
347 */
348 public static function &import($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, []);
350 return $r;
351 }
352
353 /**
354 * Returns the list of fields that can be exported
355 *
356 * @param bool $prefix
357 *
358 * @return array
359 */
360 public static function &export($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, []);
362 return $r;
363 }
364
365 /**
366 * Returns the list of indices
367 *
368 * @param bool $localize
369 *
370 * @return array
371 */
372 public static function indices($localize = TRUE) {
373 $indices = [
374 'UI_appid' => [
375 'name' => 'UI_appid',
376 'field' => [
377 0 => 'app_guid',
378 ],
379 'localizable' => FALSE,
380 'unique' => TRUE,
381 'sig' => 'civicrm_cxn::1::app_guid',
382 ],
383 'UI_keypair_cxnid' => [
384 'name' => 'UI_keypair_cxnid',
385 'field' => [
386 0 => 'cxn_guid',
387 ],
388 'localizable' => FALSE,
389 'unique' => TRUE,
390 'sig' => 'civicrm_cxn::1::cxn_guid',
391 ],
392 ];
393 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
394 }
395
396 }