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