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