Merge pull request #10040 from jaapjansma/CRM-20333
[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
022785d8 33 * (GenCodeChecksum:5293636371f8d0062ac30e2626739e63)
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',
e501603b
TO
143 ) ,
144 'app_guid' => array(
145 'name' => 'app_guid',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Application GUID') ,
148 'description' => 'Application GUID',
149 'maxlength' => 128,
150 'size' => CRM_Utils_Type::HUGE,
522a26c9 151 'table_name' => 'civicrm_cxn',
152 'entity' => 'Cxn',
153 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
154 ) ,
155 'app_meta' => array(
156 'name' => 'app_meta',
157 'type' => CRM_Utils_Type::T_TEXT,
158 'title' => ts('Application Metadata (JSON)') ,
159 'description' => 'Application Metadata (JSON)',
522a26c9 160 'table_name' => 'civicrm_cxn',
161 'entity' => 'Cxn',
162 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
163 ) ,
164 'cxn_guid' => array(
165 'name' => 'cxn_guid',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Connection GUID') ,
168 'description' => 'Connection GUID',
169 'maxlength' => 128,
170 'size' => CRM_Utils_Type::HUGE,
522a26c9 171 'table_name' => 'civicrm_cxn',
172 'entity' => 'Cxn',
173 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
174 ) ,
175 'secret' => array(
176 'name' => 'secret',
177 'type' => CRM_Utils_Type::T_TEXT,
178 'title' => ts('Secret') ,
179 'description' => 'Shared secret',
522a26c9 180 'table_name' => 'civicrm_cxn',
181 'entity' => 'Cxn',
182 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
183 ) ,
184 'perm' => array(
185 'name' => 'perm',
186 'type' => CRM_Utils_Type::T_TEXT,
187 'title' => ts('Perm') ,
188 'description' => 'Permissions approved for the service (JSON)',
522a26c9 189 'table_name' => 'civicrm_cxn',
190 'entity' => 'Cxn',
191 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
192 ) ,
193 'options' => array(
194 'name' => 'options',
195 'type' => CRM_Utils_Type::T_TEXT,
196 'title' => ts('Options') ,
197 'description' => 'Options for the service (JSON)',
522a26c9 198 'table_name' => 'civicrm_cxn',
199 'entity' => 'Cxn',
200 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
201 ) ,
202 'is_active' => array(
203 'name' => 'is_active',
204 'type' => CRM_Utils_Type::T_BOOLEAN,
205 'title' => ts('Is Active') ,
206 'description' => 'Is connection currently enabled?',
207 'default' => '1',
522a26c9 208 'table_name' => 'civicrm_cxn',
209 'entity' => 'Cxn',
210 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
211 ) ,
212 'created_date' => array(
213 'name' => 'created_date',
214 'type' => CRM_Utils_Type::T_TIMESTAMP,
215 'title' => ts('Created Date') ,
216 'description' => 'When was the connection was created.',
217 'required' => false,
218 'default' => 'NULL',
522a26c9 219 'table_name' => 'civicrm_cxn',
220 'entity' => 'Cxn',
221 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
222 ) ,
223 'modified_date' => array(
224 'name' => 'modified_date',
225 'type' => CRM_Utils_Type::T_TIMESTAMP,
226 'title' => ts('Modified Date') ,
227 'description' => 'When the connection was created or modified.',
228 'required' => false,
229 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
522a26c9 230 'table_name' => 'civicrm_cxn',
231 'entity' => 'Cxn',
232 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
233 ) ,
234 'fetched_date' => array(
235 'name' => 'fetched_date',
236 'type' => CRM_Utils_Type::T_TIMESTAMP,
237 'title' => ts('Fetched Date') ,
238 'description' => 'The last time the application metadata was fetched.',
239 'required' => false,
240 'default' => 'NULL',
522a26c9 241 'table_name' => 'civicrm_cxn',
242 'entity' => 'Cxn',
243 'bao' => 'CRM_Cxn_BAO_Cxn',
e501603b
TO
244 ) ,
245 );
346aaaba 246 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 247 }
346aaaba 248 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
249 }
250 /**
bd8e0b14 251 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
252 *
253 * @return array
bd8e0b14 254 * Array(string $name => string $uniqueName).
e501603b
TO
255 */
256 static function &fieldKeys() {
bd8e0b14
TO
257 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
258 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 259 }
bd8e0b14 260 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
261 }
262 /**
263 * Returns the names of this table
264 *
265 * @return string
266 */
267 static function getTableName() {
268 return self::$_tableName;
269 }
270 /**
271 * Returns if this table needs to be logged
272 *
273 * @return boolean
274 */
275 function getLog() {
276 return self::$_log;
277 }
278 /**
279 * Returns the list of fields that can be imported
280 *
281 * @param bool $prefix
282 *
283 * @return array
284 */
285 static function &import($prefix = false) {
60808919
TO
286 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, array());
287 return $r;
e501603b
TO
288 }
289 /**
290 * Returns the list of fields that can be exported
291 *
292 * @param bool $prefix
293 *
294 * @return array
295 */
296 static function &export($prefix = false) {
60808919
TO
297 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, array());
298 return $r;
e501603b
TO
299 }
300}