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