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