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