Merge pull request #19766 from WeMoveEU/faster-select2-groups
[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:2d6717d85561fa14908152df42d9f6ce)
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
38 */
39 public $id;
40
41 /**
42 * Machine name for Case Type
43 *
44 * @var string
45 */
46 public $name;
47
48 /**
49 * Natural language name for Case Type
50 *
51 * @var string
52 */
53 public $title;
54
55 /**
56 * Description of the Case Type
57 *
58 * @var string
59 */
60 public $description;
61
62 /**
63 * Is this entry active?
64 *
65 * @var bool
66 */
67 public $is_active;
68
69 /**
70 * Is this case type a predefined system type?
71 *
72 * @var bool
73 */
74 public $is_reserved;
75
76 /**
77 * Ordering of the case types
78 *
79 * @var int
80 */
81 public $weight;
82
83 /**
84 * xml definition of case type
85 *
86 * @var blob
87 */
88 public $definition;
89
90 /**
91 * Class constructor.
92 */
93 public function __construct() {
94 $this->__table = 'civicrm_case_type';
95 parent::__construct();
96 }
97
98 /**
99 * Returns localized title of this entity.
100 *
101 * @param bool $plural
102 * Whether to return the plural version of the title.
103 */
104 public static function getEntityTitle($plural = FALSE) {
105 return $plural ? ts('Case Types') : ts('Case Type');
106 }
107
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 public static function &fields() {
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Case Type ID'),
120 'description' => ts('Autoincremented type id'),
121 'required' => TRUE,
122 'where' => 'civicrm_case_type.id',
123 'table_name' => 'civicrm_case_type',
124 'entity' => 'CaseType',
125 'bao' => 'CRM_Case_BAO_CaseType',
126 'localizable' => 0,
127 'html' => [
128 'type' => 'Number',
129 ],
130 'readonly' => TRUE,
131 'add' => '4.5',
132 ],
133 'name' => [
134 'name' => 'name',
135 'type' => CRM_Utils_Type::T_STRING,
136 'title' => ts('Case Type Name'),
137 'description' => ts('Machine name for Case Type'),
138 'required' => TRUE,
139 'maxlength' => 64,
140 'size' => CRM_Utils_Type::BIG,
141 'where' => 'civicrm_case_type.name',
142 'table_name' => 'civicrm_case_type',
143 'entity' => 'CaseType',
144 'bao' => 'CRM_Case_BAO_CaseType',
145 'localizable' => 0,
146 'add' => '4.5',
147 ],
148 'title' => [
149 'name' => 'title',
150 'type' => CRM_Utils_Type::T_STRING,
151 'title' => ts('Case Type Title'),
152 'description' => ts('Natural language name for Case Type'),
153 'required' => TRUE,
154 'maxlength' => 64,
155 'size' => CRM_Utils_Type::BIG,
156 'where' => 'civicrm_case_type.title',
157 'table_name' => 'civicrm_case_type',
158 'entity' => 'CaseType',
159 'bao' => 'CRM_Case_BAO_CaseType',
160 'localizable' => 1,
161 'add' => '4.5',
162 ],
163 'description' => [
164 'name' => 'description',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Case Type Description'),
167 'description' => ts('Description of the Case Type'),
168 'maxlength' => 255,
169 'size' => CRM_Utils_Type::HUGE,
170 'where' => 'civicrm_case_type.description',
171 'table_name' => 'civicrm_case_type',
172 'entity' => 'CaseType',
173 'bao' => 'CRM_Case_BAO_CaseType',
174 'localizable' => 1,
175 'add' => '4.5',
176 ],
177 'is_active' => [
178 'name' => 'is_active',
179 'type' => CRM_Utils_Type::T_BOOLEAN,
180 'title' => ts('Case Type Is Active'),
181 'description' => ts('Is this entry active?'),
182 'where' => 'civicrm_case_type.is_active',
183 'table_name' => 'civicrm_case_type',
184 'entity' => 'CaseType',
185 'bao' => 'CRM_Case_BAO_CaseType',
186 'localizable' => 0,
187 'add' => '4.5',
188 ],
189 'is_reserved' => [
190 'name' => 'is_reserved',
191 'type' => CRM_Utils_Type::T_BOOLEAN,
192 'title' => ts('Case Type Is Reserved'),
193 'description' => ts('Is this case type a predefined system type?'),
194 'where' => 'civicrm_case_type.is_reserved',
195 'table_name' => 'civicrm_case_type',
196 'entity' => 'CaseType',
197 'bao' => 'CRM_Case_BAO_CaseType',
198 'localizable' => 0,
199 'add' => '4.5',
200 ],
201 'weight' => [
202 'name' => 'weight',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Order'),
205 'description' => ts('Ordering of the case types'),
206 'required' => TRUE,
207 'where' => 'civicrm_case_type.weight',
208 'default' => '1',
209 'table_name' => 'civicrm_case_type',
210 'entity' => 'CaseType',
211 'bao' => 'CRM_Case_BAO_CaseType',
212 'localizable' => 0,
213 'add' => '4.5',
214 ],
215 'definition' => [
216 'name' => 'definition',
217 'type' => CRM_Utils_Type::T_BLOB,
218 'title' => ts('Case Type Definition'),
219 'description' => ts('xml definition of case type'),
220 'where' => 'civicrm_case_type.definition',
221 'table_name' => 'civicrm_case_type',
222 'entity' => 'CaseType',
223 'bao' => 'CRM_Case_BAO_CaseType',
224 'localizable' => 0,
225 'add' => '4.5',
226 ],
227 ];
228 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
229 }
230 return Civi::$statics[__CLASS__]['fields'];
231 }
232
233 /**
234 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 *
236 * @return array
237 * Array(string $name => string $uniqueName).
238 */
239 public static function &fieldKeys() {
240 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
241 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
242 }
243 return Civi::$statics[__CLASS__]['fieldKeys'];
244 }
245
246 /**
247 * Returns the names of this table
248 *
249 * @return string
250 */
251 public static function getTableName() {
252 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
253 }
254
255 /**
256 * Returns if this table needs to be logged
257 *
258 * @return bool
259 */
260 public function getLog() {
261 return self::$_log;
262 }
263
264 /**
265 * Returns the list of fields that can be imported
266 *
267 * @param bool $prefix
268 *
269 * @return array
270 */
271 public static function &import($prefix = FALSE) {
272 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_type', $prefix, []);
273 return $r;
274 }
275
276 /**
277 * Returns the list of fields that can be exported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 public static function &export($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_type', $prefix, []);
285 return $r;
286 }
287
288 /**
289 * Returns the list of indices
290 *
291 * @param bool $localize
292 *
293 * @return array
294 */
295 public static function indices($localize = TRUE) {
296 $indices = [
297 'case_type_name' => [
298 'name' => 'case_type_name',
299 'field' => [
300 0 => 'name',
301 ],
302 'localizable' => FALSE,
303 'unique' => TRUE,
304 'sig' => 'civicrm_case_type::1::name',
305 ],
306 ];
307 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
308 }
309
310 }