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