ee7da6e5021c8cefd632f436ae7bbde1b42de79a
[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:570f59a162584f56d66ee72a09e0c6c9)
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 public 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 public static $_log = FALSE;
30
31 /**
32 * Local Extension ID
33 *
34 * @var int
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 bool
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 localized title of this entity.
95 */
96 public static function getEntityTitle() {
97 return ts('Extensions');
98 }
99
100 /**
101 * Returns all the column names of this table
102 *
103 * @return array
104 */
105 public static function &fields() {
106 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
107 Civi::$statics[__CLASS__]['fields'] = [
108 'id' => [
109 'name' => 'id',
110 'type' => CRM_Utils_Type::T_INT,
111 'title' => ts('Extension ID'),
112 'description' => ts('Local Extension ID'),
113 'required' => TRUE,
114 'where' => 'civicrm_extension.id',
115 'table_name' => 'civicrm_extension',
116 'entity' => 'Extension',
117 'bao' => 'CRM_Core_BAO_Extension',
118 'localizable' => 0,
119 ],
120 'type' => [
121 'name' => 'type',
122 'type' => CRM_Utils_Type::T_STRING,
123 'title' => ts('Type'),
124 'required' => TRUE,
125 'maxlength' => 8,
126 'size' => CRM_Utils_Type::EIGHT,
127 'where' => 'civicrm_extension.type',
128 'table_name' => 'civicrm_extension',
129 'entity' => 'Extension',
130 'bao' => 'CRM_Core_BAO_Extension',
131 'localizable' => 0,
132 'html' => [
133 'type' => 'Select',
134 ],
135 'pseudoconstant' => [
136 'callback' => 'CRM_Core_SelectValues::getExtensionTypes',
137 ],
138 ],
139 'full_name' => [
140 'name' => 'full_name',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('Key'),
143 'description' => ts('Fully qualified extension name'),
144 'required' => TRUE,
145 'maxlength' => 255,
146 'size' => CRM_Utils_Type::HUGE,
147 'where' => 'civicrm_extension.full_name',
148 'table_name' => 'civicrm_extension',
149 'entity' => 'Extension',
150 'bao' => 'CRM_Core_BAO_Extension',
151 'localizable' => 0,
152 ],
153 'name' => [
154 'name' => 'name',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Name'),
157 'description' => ts('Short name'),
158 'maxlength' => 255,
159 'size' => CRM_Utils_Type::HUGE,
160 'import' => TRUE,
161 'where' => 'civicrm_extension.name',
162 'export' => TRUE,
163 'table_name' => 'civicrm_extension',
164 'entity' => 'Extension',
165 'bao' => 'CRM_Core_BAO_Extension',
166 'localizable' => 0,
167 ],
168 'label' => [
169 'name' => 'label',
170 'type' => CRM_Utils_Type::T_STRING,
171 'title' => ts('Label'),
172 'description' => ts('Short, printable name'),
173 'maxlength' => 255,
174 'size' => CRM_Utils_Type::HUGE,
175 'import' => TRUE,
176 'where' => 'civicrm_extension.label',
177 'export' => TRUE,
178 'table_name' => 'civicrm_extension',
179 'entity' => 'Extension',
180 'bao' => 'CRM_Core_BAO_Extension',
181 'localizable' => 0,
182 ],
183 'file' => [
184 'name' => 'file',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('File'),
187 'description' => ts('Primary PHP file'),
188 'maxlength' => 255,
189 'size' => CRM_Utils_Type::HUGE,
190 'import' => TRUE,
191 'where' => 'civicrm_extension.file',
192 'export' => TRUE,
193 'table_name' => 'civicrm_extension',
194 'entity' => 'Extension',
195 'bao' => 'CRM_Core_BAO_Extension',
196 'localizable' => 0,
197 ],
198 'schema_version' => [
199 'name' => 'schema_version',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('Schema Version'),
202 'description' => ts('Revision code of the database schema; the format is module-defined'),
203 'maxlength' => 63,
204 'size' => CRM_Utils_Type::BIG,
205 'import' => TRUE,
206 'where' => 'civicrm_extension.schema_version',
207 'export' => TRUE,
208 'table_name' => 'civicrm_extension',
209 'entity' => 'Extension',
210 'bao' => 'CRM_Core_BAO_Extension',
211 'localizable' => 0,
212 ],
213 'is_active' => [
214 'name' => 'is_active',
215 'type' => CRM_Utils_Type::T_BOOLEAN,
216 'title' => ts('Extension is Active?'),
217 'description' => ts('Is this extension active?'),
218 'where' => 'civicrm_extension.is_active',
219 'default' => '1',
220 'table_name' => 'civicrm_extension',
221 'entity' => 'Extension',
222 'bao' => 'CRM_Core_BAO_Extension',
223 'localizable' => 0,
224 ],
225 ];
226 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
227 }
228 return Civi::$statics[__CLASS__]['fields'];
229 }
230
231 /**
232 * Return a mapping from field-name to the corresponding key (as used in fields()).
233 *
234 * @return array
235 * Array(string $name => string $uniqueName).
236 */
237 public static function &fieldKeys() {
238 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
239 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
240 }
241 return Civi::$statics[__CLASS__]['fieldKeys'];
242 }
243
244 /**
245 * Returns the names of this table
246 *
247 * @return string
248 */
249 public static function getTableName() {
250 return self::$_tableName;
251 }
252
253 /**
254 * Returns if this table needs to be logged
255 *
256 * @return bool
257 */
258 public function getLog() {
259 return self::$_log;
260 }
261
262 /**
263 * Returns the list of fields that can be imported
264 *
265 * @param bool $prefix
266 *
267 * @return array
268 */
269 public static function &import($prefix = FALSE) {
270 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'extension', $prefix, []);
271 return $r;
272 }
273
274 /**
275 * Returns the list of fields that can be exported
276 *
277 * @param bool $prefix
278 *
279 * @return array
280 */
281 public static function &export($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'extension', $prefix, []);
283 return $r;
284 }
285
286 /**
287 * Returns the list of indices
288 *
289 * @param bool $localize
290 *
291 * @return array
292 */
293 public static function indices($localize = TRUE) {
294 $indices = [
295 'UI_extension_full_name' => [
296 'name' => 'UI_extension_full_name',
297 'field' => [
298 0 => 'full_name',
299 ],
300 'localizable' => FALSE,
301 'unique' => TRUE,
302 'sig' => 'civicrm_extension::1::full_name',
303 ],
304 'UI_extension_name' => [
305 'name' => 'UI_extension_name',
306 'field' => [
307 0 => 'name',
308 ],
309 'localizable' => FALSE,
310 'sig' => 'civicrm_extension::0::name',
311 ],
312 ];
313 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
314 }
315
316 }