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