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