Commit | Line | Data |
---|---|---|
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/Setting.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:1540ee58b9ec485590f4ce8cfe94f5a4) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Setting entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Setting extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '4.1'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_setting'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = FALSE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
28979d65 CW |
34 | * @var int|string|null |
35 | * (SQL type: int unsigned) | |
36 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Unique name for setting | |
42 | * | |
28979d65 CW |
43 | * @var string|null |
44 | * (SQL type: varchar(255)) | |
45 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
46 | */ |
47 | public $name; | |
c3fc2621 | 48 | |
e501603b TO |
49 | /** |
50 | * data associated with this group / name combo | |
51 | * | |
28979d65 CW |
52 | * @var string|null |
53 | * (SQL type: text) | |
54 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
55 | */ |
56 | public $value; | |
c3fc2621 | 57 | |
e501603b TO |
58 | /** |
59 | * Which Domain is this menu item for | |
60 | * | |
28979d65 CW |
61 | * @var int|string |
62 | * (SQL type: int unsigned) | |
63 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
64 | */ |
65 | public $domain_id; | |
c3fc2621 | 66 | |
e501603b TO |
67 | /** |
68 | * FK to Contact ID if the setting is localized to a contact | |
69 | * | |
28979d65 CW |
70 | * @var int|string|null |
71 | * (SQL type: int unsigned) | |
72 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
73 | */ |
74 | public $contact_id; | |
c3fc2621 | 75 | |
e501603b TO |
76 | /** |
77 | * Is this setting a contact specific or site wide setting? | |
78 | * | |
28979d65 CW |
79 | * @var bool|string|null |
80 | * (SQL type: tinyint) | |
81 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
82 | */ |
83 | public $is_domain; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * Component that this menu item belongs to | |
87 | * | |
28979d65 CW |
88 | * @var int|string|null |
89 | * (SQL type: int unsigned) | |
90 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
91 | */ |
92 | public $component_id; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * When was the setting created | |
96 | * | |
28979d65 CW |
97 | * @var string|null |
98 | * (SQL type: datetime) | |
99 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
100 | */ |
101 | public $created_date; | |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * FK to civicrm_contact, who created this setting | |
105 | * | |
28979d65 CW |
106 | * @var int|string|null |
107 | * (SQL type: int unsigned) | |
108 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
109 | */ |
110 | public $created_id; | |
c3fc2621 | 111 | |
e501603b | 112 | /** |
f41f0342 | 113 | * Class constructor. |
e501603b | 114 | */ |
c3fc2621 | 115 | public function __construct() { |
e501603b TO |
116 | $this->__table = 'civicrm_setting'; |
117 | parent::__construct(); | |
118 | } | |
c3fc2621 | 119 | |
449c4e6b CW |
120 | /** |
121 | * Returns localized title of this entity. | |
7b66c3b5 AH |
122 | * |
123 | * @param bool $plural | |
124 | * Whether to return the plural version of the title. | |
449c4e6b | 125 | */ |
7b66c3b5 AH |
126 | public static function getEntityTitle($plural = FALSE) { |
127 | return $plural ? ts('Settings') : ts('Setting'); | |
449c4e6b CW |
128 | } |
129 | ||
e501603b | 130 | /** |
f41f0342 | 131 | * Returns foreign keys and entity references. |
e501603b TO |
132 | * |
133 | * @return array | |
134 | * [CRM_Core_Reference_Interface] | |
135 | */ | |
c3fc2621 | 136 | public static function getReferenceColumns() { |
346aaaba | 137 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 138 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
139 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
140 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
141 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); | |
142 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); | |
346aaaba | 143 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 144 | } |
346aaaba | 145 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 146 | } |
c3fc2621 | 147 | |
e501603b TO |
148 | /** |
149 | * Returns all the column names of this table | |
150 | * | |
151 | * @return array | |
152 | */ | |
c3fc2621 | 153 | public static function &fields() { |
346aaaba | 154 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
155 | Civi::$statics[__CLASS__]['fields'] = [ |
156 | 'id' => [ | |
e501603b TO |
157 | 'name' => 'id', |
158 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
159 | 'title' => ts('Setting ID'), |
160 | 'required' => TRUE, | |
a36434b9 | 161 | 'where' => 'civicrm_setting.id', |
522a26c9 | 162 | 'table_name' => 'civicrm_setting', |
163 | 'entity' => 'Setting', | |
164 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 165 | 'localizable' => 0, |
2cbbebe8 A |
166 | 'html' => [ |
167 | 'type' => 'Number', | |
168 | ], | |
1fe423d6 | 169 | 'readonly' => TRUE, |
a9d0587b | 170 | 'add' => '4.1', |
c3fc2621 CW |
171 | ], |
172 | 'name' => [ | |
e501603b TO |
173 | 'name' => 'name', |
174 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 175 | 'title' => ts('Setting Name'), |
215b423e | 176 | 'description' => ts('Unique name for setting'), |
e501603b TO |
177 | 'maxlength' => 255, |
178 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 179 | 'where' => 'civicrm_setting.name', |
522a26c9 | 180 | 'table_name' => 'civicrm_setting', |
181 | 'entity' => 'Setting', | |
182 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 183 | 'localizable' => 0, |
a9d0587b | 184 | 'add' => '4.1', |
c3fc2621 CW |
185 | ], |
186 | 'value' => [ | |
e501603b TO |
187 | 'name' => 'value', |
188 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 189 | 'title' => ts('Value'), |
215b423e | 190 | 'description' => ts('data associated with this group / name combo'), |
a36434b9 | 191 | 'where' => 'civicrm_setting.value', |
522a26c9 | 192 | 'table_name' => 'civicrm_setting', |
193 | 'entity' => 'Setting', | |
194 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 195 | 'localizable' => 0, |
2a5c9b4d | 196 | 'serialize' => self::SERIALIZE_PHP, |
c23563e3 SL |
197 | 'html' => [ |
198 | 'label' => ts("Value"), | |
199 | ], | |
a9d0587b | 200 | 'add' => '4.1', |
c3fc2621 CW |
201 | ], |
202 | 'domain_id' => [ | |
e501603b TO |
203 | 'name' => 'domain_id', |
204 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 205 | 'title' => ts('Domain ID'), |
215b423e | 206 | 'description' => ts('Which Domain is this menu item for'), |
c3fc2621 | 207 | 'required' => TRUE, |
a36434b9 | 208 | 'where' => 'civicrm_setting.domain_id', |
522a26c9 | 209 | 'table_name' => 'civicrm_setting', |
210 | 'entity' => 'Setting', | |
211 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 212 | 'localizable' => 0, |
e501603b | 213 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
214 | 'html' => [ |
215 | 'label' => ts("Domain"), | |
216 | ], | |
c3fc2621 | 217 | 'pseudoconstant' => [ |
e501603b TO |
218 | 'table' => 'civicrm_domain', |
219 | 'keyColumn' => 'id', | |
220 | 'labelColumn' => 'name', | |
e6ca0a57 | 221 | ], |
a9d0587b | 222 | 'add' => '4.1', |
c3fc2621 CW |
223 | ], |
224 | 'contact_id' => [ | |
e501603b TO |
225 | 'name' => 'contact_id', |
226 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 227 | 'title' => ts('Contact ID'), |
215b423e | 228 | 'description' => ts('FK to Contact ID if the setting is localized to a contact'), |
a36434b9 | 229 | 'where' => 'civicrm_setting.contact_id', |
522a26c9 | 230 | 'table_name' => 'civicrm_setting', |
231 | 'entity' => 'Setting', | |
232 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 233 | 'localizable' => 0, |
e501603b | 234 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
235 | 'html' => [ |
236 | 'label' => ts("Contact"), | |
237 | ], | |
a9d0587b | 238 | 'add' => '4.1', |
c3fc2621 CW |
239 | ], |
240 | 'is_domain' => [ | |
e501603b TO |
241 | 'name' => 'is_domain', |
242 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 243 | 'title' => ts('Is Domain Setting?'), |
215b423e | 244 | 'description' => ts('Is this setting a contact specific or site wide setting?'), |
a36434b9 | 245 | 'where' => 'civicrm_setting.is_domain', |
522a26c9 | 246 | 'table_name' => 'civicrm_setting', |
247 | 'entity' => 'Setting', | |
248 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 249 | 'localizable' => 0, |
a9d0587b | 250 | 'add' => '4.1', |
c3fc2621 CW |
251 | ], |
252 | 'component_id' => [ | |
e501603b TO |
253 | 'name' => 'component_id', |
254 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 255 | 'title' => ts('Component ID'), |
215b423e | 256 | 'description' => ts('Component that this menu item belongs to'), |
a36434b9 | 257 | 'where' => 'civicrm_setting.component_id', |
522a26c9 | 258 | 'table_name' => 'civicrm_setting', |
259 | 'entity' => 'Setting', | |
260 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 261 | 'localizable' => 0, |
e501603b | 262 | 'FKClassName' => 'CRM_Core_DAO_Component', |
c3fc2621 | 263 | 'html' => [ |
e501603b | 264 | 'type' => 'Select', |
2cbbebe8 | 265 | 'label' => ts("Component"), |
c3fc2621 CW |
266 | ], |
267 | 'pseudoconstant' => [ | |
e501603b TO |
268 | 'table' => 'civicrm_component', |
269 | 'keyColumn' => 'id', | |
270 | 'labelColumn' => 'name', | |
e6ca0a57 | 271 | ], |
a9d0587b | 272 | 'add' => '4.1', |
c3fc2621 CW |
273 | ], |
274 | 'created_date' => [ | |
e501603b TO |
275 | 'name' => 'created_date', |
276 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 277 | 'title' => ts('Setting Created Date'), |
215b423e | 278 | 'description' => ts('When was the setting created'), |
a36434b9 | 279 | 'where' => 'civicrm_setting.created_date', |
522a26c9 | 280 | 'table_name' => 'civicrm_setting', |
281 | 'entity' => 'Setting', | |
282 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 283 | 'localizable' => 0, |
a9d0587b | 284 | 'add' => '4.1', |
c3fc2621 CW |
285 | ], |
286 | 'created_id' => [ | |
e501603b TO |
287 | 'name' => 'created_id', |
288 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 289 | 'title' => ts('Created By Contact ID'), |
215b423e | 290 | 'description' => ts('FK to civicrm_contact, who created this setting'), |
a36434b9 | 291 | 'where' => 'civicrm_setting.created_id', |
522a26c9 | 292 | 'table_name' => 'civicrm_setting', |
293 | 'entity' => 'Setting', | |
294 | 'bao' => 'CRM_Core_BAO_Setting', | |
6a7e5e5d | 295 | 'localizable' => 0, |
e501603b | 296 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
297 | 'html' => [ |
298 | 'label' => ts("Created By"), | |
299 | ], | |
a9d0587b | 300 | 'add' => '4.1', |
c3fc2621 CW |
301 | ], |
302 | ]; | |
346aaaba | 303 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 304 | } |
346aaaba | 305 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 306 | } |
c3fc2621 | 307 | |
e501603b | 308 | /** |
bd8e0b14 | 309 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
310 | * |
311 | * @return array | |
bd8e0b14 | 312 | * Array(string $name => string $uniqueName). |
e501603b | 313 | */ |
c3fc2621 | 314 | public static function &fieldKeys() { |
bd8e0b14 TO |
315 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
316 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 317 | } |
bd8e0b14 | 318 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 319 | } |
c3fc2621 | 320 | |
e501603b TO |
321 | /** |
322 | * Returns the names of this table | |
323 | * | |
324 | * @return string | |
325 | */ | |
c3fc2621 | 326 | public static function getTableName() { |
e501603b TO |
327 | return self::$_tableName; |
328 | } | |
c3fc2621 | 329 | |
e501603b TO |
330 | /** |
331 | * Returns if this table needs to be logged | |
332 | * | |
c3fc2621 | 333 | * @return bool |
e501603b | 334 | */ |
c3fc2621 | 335 | public function getLog() { |
e501603b TO |
336 | return self::$_log; |
337 | } | |
c3fc2621 | 338 | |
e501603b TO |
339 | /** |
340 | * Returns the list of fields that can be imported | |
341 | * | |
342 | * @param bool $prefix | |
343 | * | |
344 | * @return array | |
345 | */ | |
c3fc2621 CW |
346 | public static function &import($prefix = FALSE) { |
347 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, []); | |
60808919 | 348 | return $r; |
e501603b | 349 | } |
c3fc2621 | 350 | |
e501603b TO |
351 | /** |
352 | * Returns the list of fields that can be exported | |
353 | * | |
354 | * @param bool $prefix | |
355 | * | |
356 | * @return array | |
357 | */ | |
c3fc2621 CW |
358 | public static function &export($prefix = FALSE) { |
359 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, []); | |
60808919 | 360 | return $r; |
e501603b | 361 | } |
c3fc2621 | 362 | |
e7a6b91a AS |
363 | /** |
364 | * Returns the list of indices | |
c3fc2621 CW |
365 | * |
366 | * @param bool $localize | |
367 | * | |
368 | * @return array | |
e7a6b91a AS |
369 | */ |
370 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
371 | $indices = [ |
372 | 'index_domain_contact_name' => [ | |
e7a6b91a | 373 | 'name' => 'index_domain_contact_name', |
c3fc2621 | 374 | 'field' => [ |
e7a6b91a AS |
375 | 0 => 'domain_id', |
376 | 1 => 'contact_id', | |
377 | 2 => 'name', | |
c3fc2621 CW |
378 | ], |
379 | 'localizable' => FALSE, | |
380 | 'unique' => TRUE, | |
e7a6b91a | 381 | 'sig' => 'civicrm_setting::1::domain_id::contact_id::name', |
c3fc2621 CW |
382 | ], |
383 | ]; | |
e7a6b91a AS |
384 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
385 | } | |
c3fc2621 | 386 | |
e501603b | 387 | } |