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