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:c1fda2807e8265021ffaa490325a7e4f)
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;
39 * Unique name for setting
46 * data associated with this group / name combo
53 * Which Domain is this menu item for
60 * FK to Contact ID if the setting is localized to a contact
67 * Is this setting a contact specific or site wide setting?
74 * Component that this menu item belongs to
81 * When was the setting created
88 * FK to civicrm_contact, who created this setting
97 public function __construct() {
98 $this->__table
= 'civicrm_setting';
99 parent
::__construct();
103 * Returns localized title of this entity.
105 public static function getEntityTitle() {
106 return ts('Settings');
110 * Returns foreign keys and entity references.
113 * [CRM_Core_Reference_Interface]
115 public static function getReferenceColumns() {
116 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
117 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
118 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
119 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
120 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
121 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
122 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
124 return Civi
::$statics[__CLASS__
]['links'];
128 * Returns all the column names of this table
132 public static function &fields() {
133 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
134 Civi
::$statics[__CLASS__
]['fields'] = [
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('Setting ID'),
140 'where' => 'civicrm_setting.id',
141 'table_name' => 'civicrm_setting',
142 'entity' => 'Setting',
143 'bao' => 'CRM_Core_BAO_Setting',
149 'type' => CRM_Utils_Type
::T_STRING
,
150 'title' => ts('Setting Name'),
151 'description' => ts('Unique name for setting'),
153 'size' => CRM_Utils_Type
::HUGE
,
154 'where' => 'civicrm_setting.name',
155 'table_name' => 'civicrm_setting',
156 'entity' => 'Setting',
157 'bao' => 'CRM_Core_BAO_Setting',
163 'type' => CRM_Utils_Type
::T_TEXT
,
164 'title' => ts('Value'),
165 'description' => ts('data associated with this group / name combo'),
166 'where' => 'civicrm_setting.value',
167 'table_name' => 'civicrm_setting',
168 'entity' => 'Setting',
169 'bao' => 'CRM_Core_BAO_Setting',
171 'serialize' => self
::SERIALIZE_PHP
,
175 'name' => 'domain_id',
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('Setting Domain'),
178 'description' => ts('Which Domain is this menu item for'),
180 'where' => 'civicrm_setting.domain_id',
181 'table_name' => 'civicrm_setting',
182 'entity' => 'Setting',
183 'bao' => 'CRM_Core_BAO_Setting',
185 'FKClassName' => 'CRM_Core_DAO_Domain',
186 'pseudoconstant' => [
187 'table' => 'civicrm_domain',
189 'labelColumn' => 'name',
194 'name' => 'contact_id',
195 'type' => CRM_Utils_Type
::T_INT
,
196 'title' => ts('Setting Contact'),
197 'description' => ts('FK to Contact ID if the setting is localized to a contact'),
198 'where' => 'civicrm_setting.contact_id',
199 'table_name' => 'civicrm_setting',
200 'entity' => 'Setting',
201 'bao' => 'CRM_Core_BAO_Setting',
203 'FKClassName' => 'CRM_Contact_DAO_Contact',
207 'name' => 'is_domain',
208 'type' => CRM_Utils_Type
::T_BOOLEAN
,
209 'title' => ts('Is Domain Setting?'),
210 'description' => ts('Is this setting a contact specific or site wide setting?'),
211 'where' => 'civicrm_setting.is_domain',
212 'table_name' => 'civicrm_setting',
213 'entity' => 'Setting',
214 'bao' => 'CRM_Core_BAO_Setting',
219 'name' => 'component_id',
220 'type' => CRM_Utils_Type
::T_INT
,
221 'title' => ts('Setting Component'),
222 'description' => ts('Component that this menu item belongs to'),
223 'where' => 'civicrm_setting.component_id',
224 'table_name' => 'civicrm_setting',
225 'entity' => 'Setting',
226 'bao' => 'CRM_Core_BAO_Setting',
228 'FKClassName' => 'CRM_Core_DAO_Component',
232 'pseudoconstant' => [
233 'table' => 'civicrm_component',
235 'labelColumn' => 'name',
240 'name' => 'created_date',
241 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
242 'title' => ts('Setting Created Date'),
243 'description' => ts('When was the setting created'),
244 'where' => 'civicrm_setting.created_date',
245 'table_name' => 'civicrm_setting',
246 'entity' => 'Setting',
247 'bao' => 'CRM_Core_BAO_Setting',
252 'name' => 'created_id',
253 'type' => CRM_Utils_Type
::T_INT
,
254 'title' => ts('Setting Created By'),
255 'description' => ts('FK to civicrm_contact, who created this setting'),
256 'where' => 'civicrm_setting.created_id',
257 'table_name' => 'civicrm_setting',
258 'entity' => 'Setting',
259 'bao' => 'CRM_Core_BAO_Setting',
261 'FKClassName' => 'CRM_Contact_DAO_Contact',
265 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
267 return Civi
::$statics[__CLASS__
]['fields'];
271 * Return a mapping from field-name to the corresponding key (as used in fields()).
274 * Array(string $name => string $uniqueName).
276 public static function &fieldKeys() {
277 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
278 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
280 return Civi
::$statics[__CLASS__
]['fieldKeys'];
284 * Returns the names of this table
288 public static function getTableName() {
289 return self
::$_tableName;
293 * Returns if this table needs to be logged
297 public function getLog() {
302 * Returns the list of fields that can be imported
304 * @param bool $prefix
308 public static function &import($prefix = FALSE) {
309 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'setting', $prefix, []);
314 * Returns the list of fields that can be exported
316 * @param bool $prefix
320 public static function &export($prefix = FALSE) {
321 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'setting', $prefix, []);
326 * Returns the list of indices
328 * @param bool $localize
332 public static function indices($localize = TRUE) {
334 'index_domain_contact_name' => [
335 'name' => 'index_domain_contact_name',
341 'localizable' => FALSE,
343 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;