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