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