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