Merge pull request #23961 from totten/master-mgdphp-caseacttype
[civicrm-core.git] / CRM / Core / DAO / StatusPreference.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/Core/StatusPreference.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
c1e814c7 9 * (GenCodeChecksum:3be71b1385c3b8095593a3c916f63b38)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the StatusPreference entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.7';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_status_pref';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * Unique Status Preference ID
35 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * Which Domain is this Status Preference for
44 *
28979d65
CW
45 * @var int|string
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $domain_id;
c3fc2621 50
e501603b
TO
51 /**
52 * Name of the status check this preference references.
53 *
54 * @var string
28979d65
CW
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
e501603b
TO
57 */
58 public $name;
c3fc2621 59
e501603b
TO
60 /**
61 * expires ignore_severity. NULL never hushes.
62 *
28979d65
CW
63 * @var string|null
64 * (SQL type: date)
65 * Note that values will be retrieved from the database as a string.
e501603b
TO
66 */
67 public $hush_until;
c3fc2621 68
e501603b
TO
69 /**
70 * Hush messages up to and including this severity.
71 *
28979d65
CW
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
e501603b
TO
75 */
76 public $ignore_severity;
c3fc2621 77
e501603b
TO
78 /**
79 * These settings are per-check, and can't be compared across checks.
80 *
28979d65
CW
81 * @var string|null
82 * (SQL type: varchar(255))
83 * Note that values will be retrieved from the database as a string.
e501603b
TO
84 */
85 public $prefs;
c3fc2621 86
e501603b
TO
87 /**
88 * These values are per-check, and can't be compared across checks.
89 *
28979d65
CW
90 * @var string|null
91 * (SQL type: varchar(255))
92 * Note that values will be retrieved from the database as a string.
e501603b
TO
93 */
94 public $check_info;
c3fc2621 95
ef91b100 96 /**
97 * Is this status check active?
98 *
c1e814c7 99 * @var bool|string
28979d65
CW
100 * (SQL type: tinyint)
101 * Note that values will be retrieved from the database as a string.
ef91b100 102 */
103 public $is_active;
104
e501603b 105 /**
f41f0342 106 * Class constructor.
e501603b 107 */
c3fc2621 108 public function __construct() {
e501603b
TO
109 $this->__table = 'civicrm_status_pref';
110 parent::__construct();
111 }
c3fc2621 112
449c4e6b
CW
113 /**
114 * Returns localized title of this entity.
7b66c3b5
AH
115 *
116 * @param bool $plural
117 * Whether to return the plural version of the title.
449c4e6b 118 */
7b66c3b5
AH
119 public static function getEntityTitle($plural = FALSE) {
120 return $plural ? ts('Status Preferences') : ts('Status Preference');
449c4e6b
CW
121 }
122
e501603b 123 /**
f41f0342 124 * Returns foreign keys and entity references.
e501603b
TO
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
c3fc2621 129 public static function getReferenceColumns() {
346aaaba 130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 131 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 134 }
346aaaba 135 return Civi::$statics[__CLASS__]['links'];
e501603b 136 }
c3fc2621 137
e501603b
TO
138 /**
139 * Returns all the column names of this table
140 *
141 * @return array
142 */
c3fc2621 143 public static function &fields() {
346aaaba 144 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
145 Civi::$statics[__CLASS__]['fields'] = [
146 'id' => [
e501603b
TO
147 'name' => 'id',
148 'type' => CRM_Utils_Type::T_INT,
c3fc2621 149 'title' => ts('Status Preference ID'),
215b423e 150 'description' => ts('Unique Status Preference ID'),
c3fc2621 151 'required' => TRUE,
a36434b9 152 'where' => 'civicrm_status_pref.id',
522a26c9 153 'table_name' => 'civicrm_status_pref',
154 'entity' => 'StatusPreference',
155 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 156 'localizable' => 0,
2cbbebe8
A
157 'html' => [
158 'type' => 'Number',
159 ],
1fe423d6 160 'readonly' => TRUE,
a9d0587b 161 'add' => '4.7',
c3fc2621
CW
162 ],
163 'domain_id' => [
e501603b
TO
164 'name' => 'domain_id',
165 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 166 'title' => ts('Domain ID'),
215b423e 167 'description' => ts('Which Domain is this Status Preference for'),
c3fc2621 168 'required' => TRUE,
a36434b9 169 'where' => 'civicrm_status_pref.domain_id',
522a26c9 170 'table_name' => 'civicrm_status_pref',
171 'entity' => 'StatusPreference',
172 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 173 'localizable' => 0,
e501603b 174 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
175 'html' => [
176 'label' => ts("Domain"),
177 ],
c3fc2621 178 'pseudoconstant' => [
e501603b
TO
179 'table' => 'civicrm_domain',
180 'keyColumn' => 'id',
181 'labelColumn' => 'name',
e6ca0a57 182 ],
a9d0587b 183 'add' => '4.7',
c3fc2621
CW
184 ],
185 'name' => [
e501603b
TO
186 'name' => 'name',
187 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 188 'title' => ts('Status Check Name'),
215b423e 189 'description' => ts('Name of the status check this preference references.'),
c3fc2621 190 'required' => TRUE,
e501603b
TO
191 'maxlength' => 255,
192 'size' => CRM_Utils_Type::HUGE,
c3fc2621 193 'import' => TRUE,
e501603b 194 'where' => 'civicrm_status_pref.name',
c3fc2621 195 'export' => TRUE,
522a26c9 196 'table_name' => 'civicrm_status_pref',
197 'entity' => 'StatusPreference',
198 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 199 'localizable' => 0,
a9d0587b 200 'add' => '4.7',
c3fc2621
CW
201 ],
202 'hush_until' => [
e501603b
TO
203 'name' => 'hush_until',
204 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 205 'title' => ts('Snooze Status Notifications Until'),
215b423e 206 'description' => ts('expires ignore_severity. NULL never hushes.'),
c3fc2621 207 'import' => TRUE,
e501603b 208 'where' => 'civicrm_status_pref.hush_until',
c3fc2621 209 'export' => TRUE,
5fb0de1f 210 'default' => NULL,
522a26c9 211 'table_name' => 'civicrm_status_pref',
212 'entity' => 'StatusPreference',
213 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 214 'localizable' => 0,
a9d0587b 215 'add' => '4.7',
c3fc2621
CW
216 ],
217 'ignore_severity' => [
e501603b
TO
218 'name' => 'ignore_severity',
219 'type' => CRM_Utils_Type::T_INT,
c3fc2621 220 'title' => ts('Ignore Severity'),
215b423e 221 'description' => ts('Hush messages up to and including this severity.'),
c3fc2621 222 'import' => TRUE,
e501603b 223 'where' => 'civicrm_status_pref.ignore_severity',
c3fc2621 224 'export' => TRUE,
e501603b 225 'default' => '1',
522a26c9 226 'table_name' => 'civicrm_status_pref',
227 'entity' => 'StatusPreference',
228 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 229 'localizable' => 0,
c3fc2621 230 'pseudoconstant' => [
c44d3d25 231 'callback' => 'CRM_Utils_Check::getSeverityOptions',
e6ca0a57 232 ],
a9d0587b 233 'add' => '4.7',
c3fc2621
CW
234 ],
235 'prefs' => [
e501603b
TO
236 'name' => 'prefs',
237 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 238 'title' => ts('Status Preferences'),
215b423e 239 'description' => ts('These settings are per-check, and can\'t be compared across checks.'),
e501603b
TO
240 'maxlength' => 255,
241 'size' => CRM_Utils_Type::HUGE,
a36434b9 242 'where' => 'civicrm_status_pref.prefs',
522a26c9 243 'table_name' => 'civicrm_status_pref',
244 'entity' => 'StatusPreference',
245 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 246 'localizable' => 0,
a9d0587b 247 'add' => '4.7',
c3fc2621
CW
248 ],
249 'check_info' => [
e501603b
TO
250 'name' => 'check_info',
251 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 252 'title' => ts('Check Info'),
215b423e 253 'description' => ts('These values are per-check, and can\'t be compared across checks.'),
e501603b
TO
254 'maxlength' => 255,
255 'size' => CRM_Utils_Type::HUGE,
a36434b9 256 'where' => 'civicrm_status_pref.check_info',
522a26c9 257 'table_name' => 'civicrm_status_pref',
258 'entity' => 'StatusPreference',
259 'bao' => 'CRM_Core_BAO_StatusPreference',
ef91b100 260 'localizable' => 0,
a9d0587b 261 'add' => '4.7',
ef91b100 262 ],
263 'is_active' => [
264 'name' => 'is_active',
265 'type' => CRM_Utils_Type::T_BOOLEAN,
266 'title' => ts('Check Is Active'),
267 'description' => ts('Is this status check active?'),
c1e814c7 268 'required' => TRUE,
ef91b100 269 'where' => 'civicrm_status_pref.is_active',
270 'default' => '1',
271 'table_name' => 'civicrm_status_pref',
272 'entity' => 'StatusPreference',
273 'bao' => 'CRM_Core_BAO_StatusPreference',
6a7e5e5d 274 'localizable' => 0,
a9d0587b 275 'add' => '5.19',
c3fc2621
CW
276 ],
277 ];
346aaaba 278 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 279 }
346aaaba 280 return Civi::$statics[__CLASS__]['fields'];
e501603b 281 }
c3fc2621 282
e501603b 283 /**
bd8e0b14 284 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
285 *
286 * @return array
bd8e0b14 287 * Array(string $name => string $uniqueName).
e501603b 288 */
c3fc2621 289 public static function &fieldKeys() {
bd8e0b14
TO
290 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
291 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 292 }
bd8e0b14 293 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the names of this table
298 *
299 * @return string
300 */
c3fc2621 301 public static function getTableName() {
e501603b
TO
302 return self::$_tableName;
303 }
c3fc2621 304
e501603b
TO
305 /**
306 * Returns if this table needs to be logged
307 *
c3fc2621 308 * @return bool
e501603b 309 */
c3fc2621 310 public function getLog() {
e501603b
TO
311 return self::$_log;
312 }
c3fc2621 313
e501603b
TO
314 /**
315 * Returns the list of fields that can be imported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
c3fc2621
CW
321 public static function &import($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, []);
60808919 323 return $r;
e501603b 324 }
c3fc2621 325
e501603b
TO
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
c3fc2621
CW
333 public static function &export($prefix = FALSE) {
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, []);
60808919 335 return $r;
e501603b 336 }
c3fc2621 337
e7a6b91a
AS
338 /**
339 * Returns the list of indices
c3fc2621
CW
340 *
341 * @param bool $localize
342 *
343 * @return array
e7a6b91a
AS
344 */
345 public static function indices($localize = TRUE) {
c3fc2621
CW
346 $indices = [
347 'UI_status_pref_name' => [
e7a6b91a 348 'name' => 'UI_status_pref_name',
c3fc2621 349 'field' => [
e7a6b91a 350 0 => 'name',
c3fc2621
CW
351 ],
352 'localizable' => FALSE,
e7a6b91a 353 'sig' => 'civicrm_status_pref::0::name',
c3fc2621
CW
354 ],
355 ];
e7a6b91a
AS
356 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
357 }
c3fc2621 358
e501603b 359}