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