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