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