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