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