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