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