Merge pull request #10012 from agh1/crm-20297
[civicrm-core.git] / CRM / Cxn / DAO / Cxn.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Cxn/Cxn.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 33 * (GenCodeChecksum:7837c80596c2e6d8682a48cffcb6a4d3)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Cxn_DAO_Cxn constructor.
39 */
e501603b
TO
40class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_cxn';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Connection ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Application GUID
61 *
62 * @var string
63 */
64 public $app_guid;
65 /**
66 * Application Metadata (JSON)
67 *
68 * @var text
69 */
70 public $app_meta;
71 /**
72 * Connection GUID
73 *
74 * @var string
75 */
76 public $cxn_guid;
77 /**
78 * Shared secret
79 *
80 * @var text
81 */
82 public $secret;
83 /**
84 * Permissions approved for the service (JSON)
85 *
86 * @var text
87 */
88 public $perm;
89 /**
90 * Options for the service (JSON)
91 *
92 * @var text
93 */
94 public $options;
95 /**
96 * Is connection currently enabled?
97 *
98 * @var boolean
99 */
100 public $is_active;
101 /**
102 * When was the connection was created.
103 *
104 * @var timestamp
105 */
106 public $created_date;
107 /**
108 * When the connection was created or modified.
109 *
110 * @var timestamp
111 */
112 public $modified_date;
113 /**
114 * The last time the application metadata was fetched.
115 *
116 * @var timestamp
117 */
118 public $fetched_date;
119 /**
f41f0342 120 * Class constructor.
e501603b
TO
121 */
122 function __construct() {
123 $this->__table = 'civicrm_cxn';
124 parent::__construct();
125 }
126 /**
127 * Returns all the column names of this table
128 *
129 * @return array
130 */
131 static function &fields() {
346aaaba
TO
132 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
133 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
134 'id' => array(
135 'name' => 'id',
136 'type' => CRM_Utils_Type::T_INT,
137 'title' => ts('Connection ID') ,
138 'description' => 'Connection ID',
139 'required' => true,
522a26c9 140 'table_name' => 'civicrm_cxn',
141 'entity' => 'Cxn',
142 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 143 'localizable' => 0,
e501603b
TO
144 ) ,
145 'app_guid' => array(
146 'name' => 'app_guid',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Application GUID') ,
149 'description' => 'Application GUID',
150 'maxlength' => 128,
151 'size' => CRM_Utils_Type::HUGE,
522a26c9 152 'table_name' => 'civicrm_cxn',
153 'entity' => 'Cxn',
154 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 155 'localizable' => 0,
e501603b
TO
156 ) ,
157 'app_meta' => array(
158 'name' => 'app_meta',
159 'type' => CRM_Utils_Type::T_TEXT,
160 'title' => ts('Application Metadata (JSON)') ,
161 'description' => 'Application Metadata (JSON)',
522a26c9 162 'table_name' => 'civicrm_cxn',
163 'entity' => 'Cxn',
164 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 165 'localizable' => 0,
e501603b
TO
166 ) ,
167 'cxn_guid' => array(
168 'name' => 'cxn_guid',
169 'type' => CRM_Utils_Type::T_STRING,
170 'title' => ts('Connection GUID') ,
171 'description' => 'Connection GUID',
172 'maxlength' => 128,
173 'size' => CRM_Utils_Type::HUGE,
522a26c9 174 'table_name' => 'civicrm_cxn',
175 'entity' => 'Cxn',
176 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 177 'localizable' => 0,
e501603b
TO
178 ) ,
179 'secret' => array(
180 'name' => 'secret',
181 'type' => CRM_Utils_Type::T_TEXT,
182 'title' => ts('Secret') ,
183 'description' => 'Shared secret',
522a26c9 184 'table_name' => 'civicrm_cxn',
185 'entity' => 'Cxn',
186 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 187 'localizable' => 0,
e501603b
TO
188 ) ,
189 'perm' => array(
190 'name' => 'perm',
191 'type' => CRM_Utils_Type::T_TEXT,
192 'title' => ts('Perm') ,
193 'description' => 'Permissions approved for the service (JSON)',
522a26c9 194 'table_name' => 'civicrm_cxn',
195 'entity' => 'Cxn',
196 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 197 'localizable' => 0,
e501603b
TO
198 ) ,
199 'options' => array(
200 'name' => 'options',
201 'type' => CRM_Utils_Type::T_TEXT,
202 'title' => ts('Options') ,
203 'description' => 'Options for the service (JSON)',
522a26c9 204 'table_name' => 'civicrm_cxn',
205 'entity' => 'Cxn',
206 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 207 'localizable' => 0,
e501603b
TO
208 ) ,
209 'is_active' => array(
210 'name' => 'is_active',
211 'type' => CRM_Utils_Type::T_BOOLEAN,
212 'title' => ts('Is Active') ,
213 'description' => 'Is connection currently enabled?',
214 'default' => '1',
522a26c9 215 'table_name' => 'civicrm_cxn',
216 'entity' => 'Cxn',
217 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 218 'localizable' => 0,
e501603b
TO
219 ) ,
220 'created_date' => array(
221 'name' => 'created_date',
222 'type' => CRM_Utils_Type::T_TIMESTAMP,
223 'title' => ts('Created Date') ,
224 'description' => 'When was the connection was created.',
225 'required' => false,
226 'default' => 'NULL',
522a26c9 227 'table_name' => 'civicrm_cxn',
228 'entity' => 'Cxn',
229 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 230 'localizable' => 0,
e501603b
TO
231 ) ,
232 'modified_date' => array(
233 'name' => 'modified_date',
234 'type' => CRM_Utils_Type::T_TIMESTAMP,
235 'title' => ts('Modified Date') ,
236 'description' => 'When the connection was created or modified.',
237 'required' => false,
238 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 239 'table_name' => 'civicrm_cxn',
240 'entity' => 'Cxn',
241 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 242 'localizable' => 0,
e501603b
TO
243 ) ,
244 'fetched_date' => array(
245 'name' => 'fetched_date',
246 'type' => CRM_Utils_Type::T_TIMESTAMP,
247 'title' => ts('Fetched Date') ,
248 'description' => 'The last time the application metadata was fetched.',
249 'required' => false,
250 'default' => 'NULL',
522a26c9 251 'table_name' => 'civicrm_cxn',
252 'entity' => 'Cxn',
253 'bao' => 'CRM_Cxn_BAO_Cxn',
6a7e5e5d 254 'localizable' => 0,
e501603b
TO
255 ) ,
256 );
346aaaba 257 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 258 }
346aaaba 259 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
260 }
261 /**
bd8e0b14 262 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
263 *
264 * @return array
bd8e0b14 265 * Array(string $name => string $uniqueName).
e501603b
TO
266 */
267 static function &fieldKeys() {
bd8e0b14
TO
268 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
269 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 270 }
bd8e0b14 271 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
272 }
273 /**
274 * Returns the names of this table
275 *
276 * @return string
277 */
278 static function getTableName() {
279 return self::$_tableName;
280 }
281 /**
282 * Returns if this table needs to be logged
283 *
284 * @return boolean
285 */
286 function getLog() {
287 return self::$_log;
288 }
289 /**
290 * Returns the list of fields that can be imported
291 *
292 * @param bool $prefix
293 *
294 * @return array
295 */
296 static function &import($prefix = false) {
60808919
TO
297 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, array());
298 return $r;
e501603b
TO
299 }
300 /**
301 * Returns the list of fields that can be exported
302 *
303 * @param bool $prefix
304 *
305 * @return array
306 */
307 static function &export($prefix = false) {
60808919
TO
308 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, array());
309 return $r;
e501603b 310 }
e7a6b91a
AS
311 /**
312 * Returns the list of indices
313 */
314 public static function indices($localize = TRUE) {
315 $indices = array(
316 'UI_appid' => array(
317 'name' => 'UI_appid',
318 'field' => array(
319 0 => 'app_guid',
320 ) ,
321 'localizable' => false,
322 'unique' => true,
323 'sig' => 'civicrm_cxn::1::app_guid',
324 ) ,
325 'UI_keypair_cxnid' => array(
326 'name' => 'UI_keypair_cxnid',
327 'field' => array(
328 0 => 'cxn_guid',
329 ) ,
330 'localizable' => false,
331 'unique' => true,
332 'sig' => 'civicrm_cxn::1::cxn_guid',
333 ) ,
334 );
335 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
336 }
e501603b 337}