Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[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:1540ee58b9ec485590f4ce8cfe94f5a4)
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|null
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 'where' => 'civicrm_setting.is_domain',
246 'table_name' => 'civicrm_setting',
247 'entity' => 'Setting',
248 'bao' => 'CRM_Core_BAO_Setting',
249 'localizable' => 0,
250 'add' => '4.1',
251 ],
252 'component_id' => [
253 'name' => 'component_id',
254 'type' => CRM_Utils_Type::T_INT,
255 'title' => ts('Component ID'),
256 'description' => ts('Component that this menu item belongs to'),
257 'where' => 'civicrm_setting.component_id',
258 'table_name' => 'civicrm_setting',
259 'entity' => 'Setting',
260 'bao' => 'CRM_Core_BAO_Setting',
261 'localizable' => 0,
262 'FKClassName' => 'CRM_Core_DAO_Component',
263 'html' => [
264 'type' => 'Select',
265 'label' => ts("Component"),
266 ],
267 'pseudoconstant' => [
268 'table' => 'civicrm_component',
269 'keyColumn' => 'id',
270 'labelColumn' => 'name',
271 ],
272 'add' => '4.1',
273 ],
274 'created_date' => [
275 'name' => 'created_date',
276 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
277 'title' => ts('Setting Created Date'),
278 'description' => ts('When was the setting created'),
279 'where' => 'civicrm_setting.created_date',
280 'table_name' => 'civicrm_setting',
281 'entity' => 'Setting',
282 'bao' => 'CRM_Core_BAO_Setting',
283 'localizable' => 0,
284 'add' => '4.1',
285 ],
286 'created_id' => [
287 'name' => 'created_id',
288 'type' => CRM_Utils_Type::T_INT,
289 'title' => ts('Created By Contact ID'),
290 'description' => ts('FK to civicrm_contact, who created this setting'),
291 'where' => 'civicrm_setting.created_id',
292 'table_name' => 'civicrm_setting',
293 'entity' => 'Setting',
294 'bao' => 'CRM_Core_BAO_Setting',
295 'localizable' => 0,
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
297 'html' => [
298 'label' => ts("Created By"),
299 ],
300 'add' => '4.1',
301 ],
302 ];
303 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
304 }
305 return Civi::$statics[__CLASS__]['fields'];
306 }
307
308 /**
309 * Return a mapping from field-name to the corresponding key (as used in fields()).
310 *
311 * @return array
312 * Array(string $name => string $uniqueName).
313 */
314 public static function &fieldKeys() {
315 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
316 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
317 }
318 return Civi::$statics[__CLASS__]['fieldKeys'];
319 }
320
321 /**
322 * Returns the names of this table
323 *
324 * @return string
325 */
326 public static function getTableName() {
327 return self::$_tableName;
328 }
329
330 /**
331 * Returns if this table needs to be logged
332 *
333 * @return bool
334 */
335 public function getLog() {
336 return self::$_log;
337 }
338
339 /**
340 * Returns the list of fields that can be imported
341 *
342 * @param bool $prefix
343 *
344 * @return array
345 */
346 public static function &import($prefix = FALSE) {
347 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, []);
348 return $r;
349 }
350
351 /**
352 * Returns the list of fields that can be exported
353 *
354 * @param bool $prefix
355 *
356 * @return array
357 */
358 public static function &export($prefix = FALSE) {
359 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, []);
360 return $r;
361 }
362
363 /**
364 * Returns the list of indices
365 *
366 * @param bool $localize
367 *
368 * @return array
369 */
370 public static function indices($localize = TRUE) {
371 $indices = [
372 'index_domain_contact_name' => [
373 'name' => 'index_domain_contact_name',
374 'field' => [
375 0 => 'domain_id',
376 1 => 'contact_id',
377 2 => 'name',
378 ],
379 'localizable' => FALSE,
380 'unique' => TRUE,
381 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
382 ],
383 ];
384 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
385 }
386
387 }