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