Merge pull request #15921 from civicrm/5.20
[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:ce861431549af8024fdbfe418607202f)
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 foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
101 public static function getReferenceColumns() {
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
105 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
106 }
107 return Civi::$statics[__CLASS__]['links'];
108 }
109
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
115 public static function &fields() {
116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
117 Civi::$statics[__CLASS__]['fields'] = [
118 'id' => [
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Status Preference ID'),
122 'description' => ts('Unique Status Preference ID'),
123 'required' => TRUE,
124 'where' => 'civicrm_status_pref.id',
125 'table_name' => 'civicrm_status_pref',
126 'entity' => 'StatusPreference',
127 'bao' => 'CRM_Core_BAO_StatusPreference',
128 'localizable' => 0,
129 ],
130 'domain_id' => [
131 'name' => 'domain_id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Setting Domain'),
134 'description' => ts('Which Domain is this Status Preference for'),
135 'required' => TRUE,
136 'where' => 'civicrm_status_pref.domain_id',
137 'table_name' => 'civicrm_status_pref',
138 'entity' => 'StatusPreference',
139 'bao' => 'CRM_Core_BAO_StatusPreference',
140 'localizable' => 0,
141 'FKClassName' => 'CRM_Core_DAO_Domain',
142 'pseudoconstant' => [
143 'table' => 'civicrm_domain',
144 'keyColumn' => 'id',
145 'labelColumn' => 'name',
146 ],
147 ],
148 'name' => [
149 'name' => 'name',
150 'type' => CRM_Utils_Type::T_STRING,
151 'title' => ts('Status Check Name'),
152 'description' => ts('Name of the status check this preference references.'),
153 'required' => TRUE,
154 'maxlength' => 255,
155 'size' => CRM_Utils_Type::HUGE,
156 'import' => TRUE,
157 'where' => 'civicrm_status_pref.name',
158 'export' => TRUE,
159 'table_name' => 'civicrm_status_pref',
160 'entity' => 'StatusPreference',
161 'bao' => 'CRM_Core_BAO_StatusPreference',
162 'localizable' => 0,
163 ],
164 'hush_until' => [
165 'name' => 'hush_until',
166 'type' => CRM_Utils_Type::T_DATE,
167 'title' => ts('Snooze Status Notifications Until'),
168 'description' => ts('expires ignore_severity. NULL never hushes.'),
169 'import' => TRUE,
170 'where' => 'civicrm_status_pref.hush_until',
171 'export' => TRUE,
172 'default' => 'NULL',
173 'table_name' => 'civicrm_status_pref',
174 'entity' => 'StatusPreference',
175 'bao' => 'CRM_Core_BAO_StatusPreference',
176 'localizable' => 0,
177 ],
178 'ignore_severity' => [
179 'name' => 'ignore_severity',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Ignore Severity'),
182 'description' => ts('Hush messages up to and including this severity.'),
183 'import' => TRUE,
184 'where' => 'civicrm_status_pref.ignore_severity',
185 'export' => TRUE,
186 'default' => '1',
187 'table_name' => 'civicrm_status_pref',
188 'entity' => 'StatusPreference',
189 'bao' => 'CRM_Core_BAO_StatusPreference',
190 'localizable' => 0,
191 'pseudoconstant' => [
192 'callback' => 'CRM_Utils_Check::getSeverityList',
193 ],
194 ],
195 'prefs' => [
196 'name' => 'prefs',
197 'type' => CRM_Utils_Type::T_STRING,
198 'title' => ts('Status Preferences'),
199 'description' => ts('These settings are per-check, and can\'t be compared across checks.'),
200 'maxlength' => 255,
201 'size' => CRM_Utils_Type::HUGE,
202 'where' => 'civicrm_status_pref.prefs',
203 'table_name' => 'civicrm_status_pref',
204 'entity' => 'StatusPreference',
205 'bao' => 'CRM_Core_BAO_StatusPreference',
206 'localizable' => 0,
207 ],
208 'check_info' => [
209 'name' => 'check_info',
210 'type' => CRM_Utils_Type::T_STRING,
211 'title' => ts('Check Info'),
212 'description' => ts('These values are per-check, and can\'t be compared across checks.'),
213 'maxlength' => 255,
214 'size' => CRM_Utils_Type::HUGE,
215 'where' => 'civicrm_status_pref.check_info',
216 'table_name' => 'civicrm_status_pref',
217 'entity' => 'StatusPreference',
218 'bao' => 'CRM_Core_BAO_StatusPreference',
219 'localizable' => 0,
220 ],
221 'is_active' => [
222 'name' => 'is_active',
223 'type' => CRM_Utils_Type::T_BOOLEAN,
224 'title' => ts('Check Is Active'),
225 'description' => ts('Is this status check active?'),
226 'where' => 'civicrm_status_pref.is_active',
227 'default' => '1',
228 'table_name' => 'civicrm_status_pref',
229 'entity' => 'StatusPreference',
230 'bao' => 'CRM_Core_BAO_StatusPreference',
231 'localizable' => 0,
232 ],
233 ];
234 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
235 }
236 return Civi::$statics[__CLASS__]['fields'];
237 }
238
239 /**
240 * Return a mapping from field-name to the corresponding key (as used in fields()).
241 *
242 * @return array
243 * Array(string $name => string $uniqueName).
244 */
245 public static function &fieldKeys() {
246 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
247 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
248 }
249 return Civi::$statics[__CLASS__]['fieldKeys'];
250 }
251
252 /**
253 * Returns the names of this table
254 *
255 * @return string
256 */
257 public static function getTableName() {
258 return self::$_tableName;
259 }
260
261 /**
262 * Returns if this table needs to be logged
263 *
264 * @return bool
265 */
266 public function getLog() {
267 return self::$_log;
268 }
269
270 /**
271 * Returns the list of fields that can be imported
272 *
273 * @param bool $prefix
274 *
275 * @return array
276 */
277 public static function &import($prefix = FALSE) {
278 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, []);
279 return $r;
280 }
281
282 /**
283 * Returns the list of fields that can be exported
284 *
285 * @param bool $prefix
286 *
287 * @return array
288 */
289 public static function &export($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, []);
291 return $r;
292 }
293
294 /**
295 * Returns the list of indices
296 *
297 * @param bool $localize
298 *
299 * @return array
300 */
301 public static function indices($localize = TRUE) {
302 $indices = [
303 'UI_status_pref_name' => [
304 'name' => 'UI_status_pref_name',
305 'field' => [
306 0 => 'name',
307 ],
308 'localizable' => FALSE,
309 'sig' => 'civicrm_status_pref::0::name',
310 ],
311 ];
312 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
313 }
314
315 }