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