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