Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / Extension.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/Core/Extension.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:6fdc48310a3cb4c35b5a3fa3a8aca079)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_Extension constructor.
39 */
40 class CRM_Core_DAO_Extension extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_extension';
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 * Local Extension ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 *
61 * @var string
62 */
63 public $type;
64 /**
65 * Fully qualified extension name
66 *
67 * @var string
68 */
69 public $full_name;
70 /**
71 * Short name
72 *
73 * @var string
74 */
75 public $name;
76 /**
77 * Short, printable name
78 *
79 * @var string
80 */
81 public $label;
82 /**
83 * Primary PHP file
84 *
85 * @var string
86 */
87 public $file;
88 /**
89 * Revision code of the database schema; the format is module-defined
90 *
91 * @var string
92 */
93 public $schema_version;
94 /**
95 * Is this extension active?
96 *
97 * @var boolean
98 */
99 public $is_active;
100 /**
101 * Class constructor.
102 */
103 function __construct() {
104 $this->__table = 'civicrm_extension';
105 parent::__construct();
106 }
107 /**
108 * Returns all the column names of this table
109 *
110 * @return array
111 */
112 static function &fields() {
113 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
114 Civi::$statics[__CLASS__]['fields'] = array(
115 'id' => array(
116 'name' => 'id',
117 'type' => CRM_Utils_Type::T_INT,
118 'title' => ts('Extension ID') ,
119 'description' => 'Local Extension ID',
120 'required' => true,
121 'table_name' => 'civicrm_extension',
122 'entity' => 'Extension',
123 'bao' => 'CRM_Core_BAO_Extension',
124 'localizable' => 0,
125 ) ,
126 'type' => array(
127 'name' => 'type',
128 'type' => CRM_Utils_Type::T_STRING,
129 'title' => ts('Type') ,
130 'required' => true,
131 'maxlength' => 8,
132 'size' => CRM_Utils_Type::EIGHT,
133 'table_name' => 'civicrm_extension',
134 'entity' => 'Extension',
135 'bao' => 'CRM_Core_BAO_Extension',
136 'localizable' => 0,
137 'html' => array(
138 'type' => 'Select',
139 ) ,
140 'pseudoconstant' => array(
141 'callback' => 'CRM_Core_SelectValues::getExtensionTypes',
142 )
143 ) ,
144 'full_name' => array(
145 'name' => 'full_name',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Key') ,
148 'description' => 'Fully qualified extension name',
149 'required' => true,
150 'maxlength' => 255,
151 'size' => CRM_Utils_Type::HUGE,
152 'table_name' => 'civicrm_extension',
153 'entity' => 'Extension',
154 'bao' => 'CRM_Core_BAO_Extension',
155 'localizable' => 0,
156 ) ,
157 'name' => array(
158 'name' => 'name',
159 'type' => CRM_Utils_Type::T_STRING,
160 'title' => ts('Name') ,
161 'description' => 'Short name',
162 'maxlength' => 255,
163 'size' => CRM_Utils_Type::HUGE,
164 'import' => true,
165 'where' => 'civicrm_extension.name',
166 'headerPattern' => '',
167 'dataPattern' => '',
168 'export' => true,
169 'table_name' => 'civicrm_extension',
170 'entity' => 'Extension',
171 'bao' => 'CRM_Core_BAO_Extension',
172 'localizable' => 0,
173 ) ,
174 'label' => array(
175 'name' => 'label',
176 'type' => CRM_Utils_Type::T_STRING,
177 'title' => ts('Label') ,
178 'description' => 'Short, printable name',
179 'maxlength' => 255,
180 'size' => CRM_Utils_Type::HUGE,
181 'import' => true,
182 'where' => 'civicrm_extension.label',
183 'headerPattern' => '',
184 'dataPattern' => '',
185 'export' => true,
186 'table_name' => 'civicrm_extension',
187 'entity' => 'Extension',
188 'bao' => 'CRM_Core_BAO_Extension',
189 'localizable' => 0,
190 ) ,
191 'file' => array(
192 'name' => 'file',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('File') ,
195 'description' => 'Primary PHP file',
196 'maxlength' => 255,
197 'size' => CRM_Utils_Type::HUGE,
198 'import' => true,
199 'where' => 'civicrm_extension.file',
200 'headerPattern' => '',
201 'dataPattern' => '',
202 'export' => true,
203 'table_name' => 'civicrm_extension',
204 'entity' => 'Extension',
205 'bao' => 'CRM_Core_BAO_Extension',
206 'localizable' => 0,
207 ) ,
208 'schema_version' => array(
209 'name' => 'schema_version',
210 'type' => CRM_Utils_Type::T_STRING,
211 'title' => ts('Schema Version') ,
212 'description' => 'Revision code of the database schema; the format is module-defined',
213 'maxlength' => 63,
214 'size' => CRM_Utils_Type::BIG,
215 'import' => true,
216 'where' => 'civicrm_extension.schema_version',
217 'headerPattern' => '',
218 'dataPattern' => '',
219 'export' => true,
220 'table_name' => 'civicrm_extension',
221 'entity' => 'Extension',
222 'bao' => 'CRM_Core_BAO_Extension',
223 'localizable' => 0,
224 ) ,
225 'is_active' => array(
226 'name' => 'is_active',
227 'type' => CRM_Utils_Type::T_BOOLEAN,
228 'title' => ts('Extension is Active?') ,
229 'description' => 'Is this extension active?',
230 'default' => '1',
231 'table_name' => 'civicrm_extension',
232 'entity' => 'Extension',
233 'bao' => 'CRM_Core_BAO_Extension',
234 'localizable' => 0,
235 ) ,
236 );
237 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
238 }
239 return Civi::$statics[__CLASS__]['fields'];
240 }
241 /**
242 * Return a mapping from field-name to the corresponding key (as used in fields()).
243 *
244 * @return array
245 * Array(string $name => string $uniqueName).
246 */
247 static function &fieldKeys() {
248 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
249 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
250 }
251 return Civi::$statics[__CLASS__]['fieldKeys'];
252 }
253 /**
254 * Returns the names of this table
255 *
256 * @return string
257 */
258 static function getTableName() {
259 return self::$_tableName;
260 }
261 /**
262 * Returns if this table needs to be logged
263 *
264 * @return boolean
265 */
266 function getLog() {
267 return self::$_log;
268 }
269 /**
270 * Returns the list of fields that can be imported
271 *
272 * @param bool $prefix
273 *
274 * @return array
275 */
276 static function &import($prefix = false) {
277 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'extension', $prefix, array());
278 return $r;
279 }
280 /**
281 * Returns the list of fields that can be exported
282 *
283 * @param bool $prefix
284 *
285 * @return array
286 */
287 static function &export($prefix = false) {
288 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'extension', $prefix, array());
289 return $r;
290 }
291 /**
292 * Returns the list of indices
293 */
294 public static function indices($localize = TRUE) {
295 $indices = array(
296 'UI_extension_full_name' => array(
297 'name' => 'UI_extension_full_name',
298 'field' => array(
299 0 => 'full_name',
300 ) ,
301 'localizable' => false,
302 'unique' => true,
303 'sig' => 'civicrm_extension::1::full_name',
304 ) ,
305 'UI_extension_name' => array(
306 'name' => 'UI_extension_name',
307 'field' => array(
308 0 => 'name',
309 ) ,
310 'localizable' => false,
311 'sig' => 'civicrm_extension::0::name',
312 ) ,
313 );
314 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
315 }
316 }