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