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