Merge pull request #19907 from colemanw/civiCaseApi
[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:e97808735d244f6b2c7e84c9dd375fe7)
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 case type enabled?
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 case type enabled?'),
182 'where' => 'civicrm_case_type.is_active',
183 'default' => '1',
184 'table_name' => 'civicrm_case_type',
185 'entity' => 'CaseType',
186 'bao' => 'CRM_Case_BAO_CaseType',
187 'localizable' => 0,
188 'add' => '4.5',
189 ],
190 'is_reserved' => [
191 'name' => 'is_reserved',
192 'type' => CRM_Utils_Type::T_BOOLEAN,
193 'title' => ts('Case Type Is Reserved'),
194 'description' => ts('Is this case type a predefined system type?'),
195 'where' => 'civicrm_case_type.is_reserved',
196 'table_name' => 'civicrm_case_type',
197 'entity' => 'CaseType',
198 'bao' => 'CRM_Case_BAO_CaseType',
199 'localizable' => 0,
200 'add' => '4.5',
201 ],
202 'weight' => [
203 'name' => 'weight',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Order'),
206 'description' => ts('Ordering of the case types'),
207 'required' => TRUE,
208 'where' => 'civicrm_case_type.weight',
209 'default' => '1',
210 'table_name' => 'civicrm_case_type',
211 'entity' => 'CaseType',
212 'bao' => 'CRM_Case_BAO_CaseType',
213 'localizable' => 0,
214 'add' => '4.5',
215 ],
216 'definition' => [
217 'name' => 'definition',
218 'type' => CRM_Utils_Type::T_BLOB,
219 'title' => ts('Case Type Definition'),
220 'description' => ts('xml definition of case type'),
221 'where' => 'civicrm_case_type.definition',
222 'table_name' => 'civicrm_case_type',
223 'entity' => 'CaseType',
224 'bao' => 'CRM_Case_BAO_CaseType',
225 'localizable' => 0,
226 'add' => '4.5',
227 ],
228 ];
229 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
230 }
231 return Civi::$statics[__CLASS__]['fields'];
232 }
233
234 /**
235 * Return a mapping from field-name to the corresponding key (as used in fields()).
236 *
237 * @return array
238 * Array(string $name => string $uniqueName).
239 */
240 public static function &fieldKeys() {
241 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
242 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
243 }
244 return Civi::$statics[__CLASS__]['fieldKeys'];
245 }
246
247 /**
248 * Returns the names of this table
249 *
250 * @return string
251 */
252 public static function getTableName() {
253 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
254 }
255
256 /**
257 * Returns if this table needs to be logged
258 *
259 * @return bool
260 */
261 public function getLog() {
262 return self::$_log;
263 }
264
265 /**
266 * Returns the list of fields that can be imported
267 *
268 * @param bool $prefix
269 *
270 * @return array
271 */
272 public static function &import($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_type', $prefix, []);
274 return $r;
275 }
276
277 /**
278 * Returns the list of fields that can be exported
279 *
280 * @param bool $prefix
281 *
282 * @return array
283 */
284 public static function &export($prefix = FALSE) {
285 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_type', $prefix, []);
286 return $r;
287 }
288
289 /**
290 * Returns the list of indices
291 *
292 * @param bool $localize
293 *
294 * @return array
295 */
296 public static function indices($localize = TRUE) {
297 $indices = [
298 'case_type_name' => [
299 'name' => 'case_type_name',
300 'field' => [
301 0 => 'name',
302 ],
303 'localizable' => FALSE,
304 'unique' => TRUE,
305 'sig' => 'civicrm_case_type::1::name',
306 ],
307 ];
308 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
309 }
310
311 }