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