Merge pull request #11371 from MiyaNoctem/CRM-21520-action-to-add-contacts-to-case
[civicrm-core.git] / CRM / Cxn / DAO / Cxn.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Cxn/Cxn.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:90ebdb9687fcc28fb71ec5ef15dafc1b)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Cxn_DAO_Cxn constructor.
39 */
40 class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_cxn';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
120 * Class constructor.
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() {
132 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
133 Civi::$statics[__CLASS__]['fields'] = array(
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,
140 'table_name' => 'civicrm_cxn',
141 'entity' => 'Cxn',
142 'bao' => 'CRM_Cxn_BAO_Cxn',
143 'localizable' => 0,
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,
152 'table_name' => 'civicrm_cxn',
153 'entity' => 'Cxn',
154 'bao' => 'CRM_Cxn_BAO_Cxn',
155 'localizable' => 0,
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)',
162 'table_name' => 'civicrm_cxn',
163 'entity' => 'Cxn',
164 'bao' => 'CRM_Cxn_BAO_Cxn',
165 'localizable' => 0,
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,
174 'table_name' => 'civicrm_cxn',
175 'entity' => 'Cxn',
176 'bao' => 'CRM_Cxn_BAO_Cxn',
177 'localizable' => 0,
178 ) ,
179 'secret' => array(
180 'name' => 'secret',
181 'type' => CRM_Utils_Type::T_TEXT,
182 'title' => ts('Secret') ,
183 'description' => 'Shared secret',
184 'table_name' => 'civicrm_cxn',
185 'entity' => 'Cxn',
186 'bao' => 'CRM_Cxn_BAO_Cxn',
187 'localizable' => 0,
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)',
194 'table_name' => 'civicrm_cxn',
195 'entity' => 'Cxn',
196 'bao' => 'CRM_Cxn_BAO_Cxn',
197 'localizable' => 0,
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)',
204 'table_name' => 'civicrm_cxn',
205 'entity' => 'Cxn',
206 'bao' => 'CRM_Cxn_BAO_Cxn',
207 'localizable' => 0,
208 'serialize' => self::SERIALIZE_JSON,
209 ) ,
210 'is_active' => array(
211 'name' => 'is_active',
212 'type' => CRM_Utils_Type::T_BOOLEAN,
213 'title' => ts('Is Active') ,
214 'description' => 'Is connection currently enabled?',
215 'default' => '1',
216 'table_name' => 'civicrm_cxn',
217 'entity' => 'Cxn',
218 'bao' => 'CRM_Cxn_BAO_Cxn',
219 'localizable' => 0,
220 ) ,
221 'created_date' => array(
222 'name' => 'created_date',
223 'type' => CRM_Utils_Type::T_TIMESTAMP,
224 'title' => ts('Created Date') ,
225 'description' => 'When was the connection was created.',
226 'required' => false,
227 'default' => 'NULL',
228 'table_name' => 'civicrm_cxn',
229 'entity' => 'Cxn',
230 'bao' => 'CRM_Cxn_BAO_Cxn',
231 'localizable' => 0,
232 ) ,
233 'modified_date' => array(
234 'name' => 'modified_date',
235 'type' => CRM_Utils_Type::T_TIMESTAMP,
236 'title' => ts('Modified Date') ,
237 'description' => 'When the connection was created or modified.',
238 'required' => false,
239 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
240 'table_name' => 'civicrm_cxn',
241 'entity' => 'Cxn',
242 'bao' => 'CRM_Cxn_BAO_Cxn',
243 'localizable' => 0,
244 ) ,
245 'fetched_date' => array(
246 'name' => 'fetched_date',
247 'type' => CRM_Utils_Type::T_TIMESTAMP,
248 'title' => ts('Fetched Date') ,
249 'description' => 'The last time the application metadata was fetched.',
250 'required' => false,
251 'default' => 'NULL',
252 'table_name' => 'civicrm_cxn',
253 'entity' => 'Cxn',
254 'bao' => 'CRM_Cxn_BAO_Cxn',
255 'localizable' => 0,
256 ) ,
257 );
258 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
259 }
260 return Civi::$statics[__CLASS__]['fields'];
261 }
262 /**
263 * Return a mapping from field-name to the corresponding key (as used in fields()).
264 *
265 * @return array
266 * Array(string $name => string $uniqueName).
267 */
268 static function &fieldKeys() {
269 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
270 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
271 }
272 return Civi::$statics[__CLASS__]['fieldKeys'];
273 }
274 /**
275 * Returns the names of this table
276 *
277 * @return string
278 */
279 static function getTableName() {
280 return self::$_tableName;
281 }
282 /**
283 * Returns if this table needs to be logged
284 *
285 * @return boolean
286 */
287 function getLog() {
288 return self::$_log;
289 }
290 /**
291 * Returns the list of fields that can be imported
292 *
293 * @param bool $prefix
294 *
295 * @return array
296 */
297 static function &import($prefix = false) {
298 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, array());
299 return $r;
300 }
301 /**
302 * Returns the list of fields that can be exported
303 *
304 * @param bool $prefix
305 *
306 * @return array
307 */
308 static function &export($prefix = false) {
309 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, array());
310 return $r;
311 }
312 /**
313 * Returns the list of indices
314 */
315 public static function indices($localize = TRUE) {
316 $indices = array(
317 'UI_appid' => array(
318 'name' => 'UI_appid',
319 'field' => array(
320 0 => 'app_guid',
321 ) ,
322 'localizable' => false,
323 'unique' => true,
324 'sig' => 'civicrm_cxn::1::app_guid',
325 ) ,
326 'UI_keypair_cxnid' => array(
327 'name' => 'UI_keypair_cxnid',
328 'field' => array(
329 0 => 'cxn_guid',
330 ) ,
331 'localizable' => false,
332 'unique' => true,
333 'sig' => 'civicrm_cxn::1::cxn_guid',
334 ) ,
335 );
336 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
337 }
338 }