5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Setting.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1540ee58b9ec485590f4ce8cfe94f5a4)
13 * Database access object for the Setting entity.
15 class CRM_Core_DAO_Setting
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_setting';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
41 * Unique name for setting
44 * (SQL type: varchar(255))
45 * Note that values will be retrieved from the database as a string.
50 * data associated with this group / name combo
54 * Note that values will be retrieved from the database as a string.
59 * Which Domain is this menu item for
62 * (SQL type: int unsigned)
63 * Note that values will be retrieved from the database as a string.
68 * FK to Contact ID if the setting is localized to a contact
70 * @var int|string|null
71 * (SQL type: int unsigned)
72 * Note that values will be retrieved from the database as a string.
77 * Is this setting a contact specific or site wide setting?
79 * @var bool|string|null
81 * Note that values will be retrieved from the database as a string.
86 * Component that this menu item belongs to
88 * @var int|string|null
89 * (SQL type: int unsigned)
90 * Note that values will be retrieved from the database as a string.
95 * When was the setting created
98 * (SQL type: datetime)
99 * Note that values will be retrieved from the database as a string.
101 public $created_date;
104 * FK to civicrm_contact, who created this setting
106 * @var int|string|null
107 * (SQL type: int unsigned)
108 * Note that values will be retrieved from the database as a string.
115 public function __construct() {
116 $this->__table
= 'civicrm_setting';
117 parent
::__construct();
121 * Returns localized title of this entity.
123 * @param bool $plural
124 * Whether to return the plural version of the title.
126 public static function getEntityTitle($plural = FALSE) {
127 return $plural ?
ts('Settings') : ts('Setting');
131 * Returns foreign keys and entity references.
134 * [CRM_Core_Reference_Interface]
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']);
145 return Civi
::$statics[__CLASS__
]['links'];
149 * Returns all the column names of this table
153 public static function &fields() {
154 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
155 Civi
::$statics[__CLASS__
]['fields'] = [
158 'type' => CRM_Utils_Type
::T_INT
,
159 'title' => ts('Setting ID'),
161 'where' => 'civicrm_setting.id',
162 'table_name' => 'civicrm_setting',
163 'entity' => 'Setting',
164 'bao' => 'CRM_Core_BAO_Setting',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Setting Name'),
176 'description' => ts('Unique name for setting'),
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',
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',
196 'serialize' => self
::SERIALIZE_PHP
,
198 'label' => ts("Value"),
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'),
208 'where' => 'civicrm_setting.domain_id',
209 'table_name' => 'civicrm_setting',
210 'entity' => 'Setting',
211 'bao' => 'CRM_Core_BAO_Setting',
213 'FKClassName' => 'CRM_Core_DAO_Domain',
215 'label' => ts("Domain"),
217 'pseudoconstant' => [
218 'table' => 'civicrm_domain',
220 'labelColumn' => 'name',
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',
234 'FKClassName' => 'CRM_Contact_DAO_Contact',
236 'label' => ts("Contact"),
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',
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',
262 'FKClassName' => 'CRM_Core_DAO_Component',
265 'label' => ts("Component"),
267 'pseudoconstant' => [
268 'table' => 'civicrm_component',
270 'labelColumn' => 'name',
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',
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',
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
298 'label' => ts("Created By"),
303 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
305 return Civi
::$statics[__CLASS__
]['fields'];
309 * Return a mapping from field-name to the corresponding key (as used in fields()).
312 * Array(string $name => string $uniqueName).
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()));
318 return Civi
::$statics[__CLASS__
]['fieldKeys'];
322 * Returns the names of this table
326 public static function getTableName() {
327 return self
::$_tableName;
331 * Returns if this table needs to be logged
335 public function getLog() {
340 * Returns the list of fields that can be imported
342 * @param bool $prefix
346 public static function &import($prefix = FALSE) {
347 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'setting', $prefix, []);
352 * Returns the list of fields that can be exported
354 * @param bool $prefix
358 public static function &export($prefix = FALSE) {
359 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'setting', $prefix, []);
364 * Returns the list of indices
366 * @param bool $localize
370 public static function indices($localize = TRUE) {
372 'index_domain_contact_name' => [
373 'name' => 'index_domain_contact_name',
379 'localizable' => FALSE,
381 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
384 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;