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