5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/StatusPreference.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3be71b1385c3b8095593a3c916f63b38)
13 * Database access object for the StatusPreference entity.
15 class CRM_Core_DAO_StatusPreference
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.7';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_status_pref';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
34 * Unique Status Preference ID
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Which Domain is this Status Preference for
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * Name of the status check this preference references.
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
61 * expires ignore_severity. NULL never hushes.
65 * Note that values will be retrieved from the database as a string.
70 * Hush messages up to and including this severity.
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
76 public $ignore_severity;
79 * These settings are per-check, and can't be compared across checks.
82 * (SQL type: varchar(255))
83 * Note that values will be retrieved from the database as a string.
88 * These values are per-check, and can't be compared across checks.
91 * (SQL type: varchar(255))
92 * Note that values will be retrieved from the database as a string.
97 * Is this status check active?
100 * (SQL type: tinyint)
101 * Note that values will be retrieved from the database as a string.
108 public function __construct() {
109 $this->__table
= 'civicrm_status_pref';
110 parent
::__construct();
114 * Returns localized title of this entity.
116 * @param bool $plural
117 * Whether to return the plural version of the title.
119 public static function getEntityTitle($plural = FALSE) {
120 return $plural ?
ts('Status Preferences') : ts('Status Preference');
124 * Returns foreign keys and entity references.
127 * [CRM_Core_Reference_Interface]
129 public static function getReferenceColumns() {
130 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
131 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
132 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
133 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
135 return Civi
::$statics[__CLASS__
]['links'];
139 * Returns all the column names of this table
143 public static function &fields() {
144 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
145 Civi
::$statics[__CLASS__
]['fields'] = [
148 'type' => CRM_Utils_Type
::T_INT
,
149 'title' => ts('Status Preference ID'),
150 'description' => ts('Unique Status Preference ID'),
152 'where' => 'civicrm_status_pref.id',
153 'table_name' => 'civicrm_status_pref',
154 'entity' => 'StatusPreference',
155 'bao' => 'CRM_Core_BAO_StatusPreference',
164 'name' => 'domain_id',
165 'type' => CRM_Utils_Type
::T_INT
,
166 'title' => ts('Domain ID'),
167 'description' => ts('Which Domain is this Status Preference for'),
169 'where' => 'civicrm_status_pref.domain_id',
170 'table_name' => 'civicrm_status_pref',
171 'entity' => 'StatusPreference',
172 'bao' => 'CRM_Core_BAO_StatusPreference',
174 'FKClassName' => 'CRM_Core_DAO_Domain',
176 'label' => ts("Domain"),
178 'pseudoconstant' => [
179 'table' => 'civicrm_domain',
181 'labelColumn' => 'name',
187 'type' => CRM_Utils_Type
::T_STRING
,
188 'title' => ts('Status Check Name'),
189 'description' => ts('Name of the status check this preference references.'),
192 'size' => CRM_Utils_Type
::HUGE
,
194 'where' => 'civicrm_status_pref.name',
196 'table_name' => 'civicrm_status_pref',
197 'entity' => 'StatusPreference',
198 'bao' => 'CRM_Core_BAO_StatusPreference',
203 'name' => 'hush_until',
204 'type' => CRM_Utils_Type
::T_DATE
,
205 'title' => ts('Snooze Status Notifications Until'),
206 'description' => ts('expires ignore_severity. NULL never hushes.'),
208 'where' => 'civicrm_status_pref.hush_until',
211 'table_name' => 'civicrm_status_pref',
212 'entity' => 'StatusPreference',
213 'bao' => 'CRM_Core_BAO_StatusPreference',
217 'ignore_severity' => [
218 'name' => 'ignore_severity',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Ignore Severity'),
221 'description' => ts('Hush messages up to and including this severity.'),
223 'where' => 'civicrm_status_pref.ignore_severity',
226 'table_name' => 'civicrm_status_pref',
227 'entity' => 'StatusPreference',
228 'bao' => 'CRM_Core_BAO_StatusPreference',
230 'pseudoconstant' => [
231 'callback' => 'CRM_Utils_Check::getSeverityOptions',
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Status Preferences'),
239 'description' => ts('These settings are per-check, and can\'t be compared across checks.'),
241 'size' => CRM_Utils_Type
::HUGE
,
242 'where' => 'civicrm_status_pref.prefs',
243 'table_name' => 'civicrm_status_pref',
244 'entity' => 'StatusPreference',
245 'bao' => 'CRM_Core_BAO_StatusPreference',
250 'name' => 'check_info',
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Check Info'),
253 'description' => ts('These values are per-check, and can\'t be compared across checks.'),
255 'size' => CRM_Utils_Type
::HUGE
,
256 'where' => 'civicrm_status_pref.check_info',
257 'table_name' => 'civicrm_status_pref',
258 'entity' => 'StatusPreference',
259 'bao' => 'CRM_Core_BAO_StatusPreference',
264 'name' => 'is_active',
265 'type' => CRM_Utils_Type
::T_BOOLEAN
,
266 'title' => ts('Check Is Active'),
267 'description' => ts('Is this status check active?'),
269 'where' => 'civicrm_status_pref.is_active',
271 'table_name' => 'civicrm_status_pref',
272 'entity' => 'StatusPreference',
273 'bao' => 'CRM_Core_BAO_StatusPreference',
278 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
280 return Civi
::$statics[__CLASS__
]['fields'];
284 * Return a mapping from field-name to the corresponding key (as used in fields()).
287 * Array(string $name => string $uniqueName).
289 public static function &fieldKeys() {
290 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
291 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
293 return Civi
::$statics[__CLASS__
]['fieldKeys'];
297 * Returns the names of this table
301 public static function getTableName() {
302 return self
::$_tableName;
306 * Returns if this table needs to be logged
310 public function getLog() {
315 * Returns the list of fields that can be imported
317 * @param bool $prefix
321 public static function &import($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'status_pref', $prefix, []);
327 * Returns the list of fields that can be exported
329 * @param bool $prefix
333 public static function &export($prefix = FALSE) {
334 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'status_pref', $prefix, []);
339 * Returns the list of indices
341 * @param bool $localize
345 public static function indices($localize = TRUE) {
347 'UI_status_pref_name' => [
348 'name' => 'UI_status_pref_name',
352 'localizable' => FALSE,
353 'sig' => 'civicrm_status_pref::0::name',
356 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;