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