5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Setting.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9fa60718e4fb92cc6b3e7f9563671b00)
13 * Database access object for the Setting entity.
15 class CRM_Core_DAO_Setting
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_setting';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * Unique name for setting
44 * data associated with this group / name combo
51 * Which Domain is this menu item for
58 * FK to Contact ID if the setting is localized to a contact
65 * Is this setting a contact specific or site wide setting?
72 * Component that this menu item belongs to
79 * When was the setting created
86 * FK to civicrm_contact, who created this setting
95 public function __construct() {
96 $this->__table
= 'civicrm_setting';
97 parent
::__construct();
101 * Returns foreign keys and entity references.
104 * [CRM_Core_Reference_Interface]
106 public static function getReferenceColumns() {
107 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
108 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
109 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
110 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
111 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
112 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
113 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
115 return Civi
::$statics[__CLASS__
]['links'];
119 * Returns all the column names of this table
123 public static function &fields() {
124 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
125 Civi
::$statics[__CLASS__
]['fields'] = [
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('Setting ID'),
131 'where' => 'civicrm_setting.id',
132 'table_name' => 'civicrm_setting',
133 'entity' => 'Setting',
134 'bao' => 'CRM_Core_BAO_Setting',
139 'type' => CRM_Utils_Type
::T_STRING
,
140 'title' => ts('Setting Name'),
141 'description' => ts('Unique name for setting'),
143 'size' => CRM_Utils_Type
::HUGE
,
144 'where' => 'civicrm_setting.name',
145 'table_name' => 'civicrm_setting',
146 'entity' => 'Setting',
147 'bao' => 'CRM_Core_BAO_Setting',
152 'type' => CRM_Utils_Type
::T_TEXT
,
153 'title' => ts('Value'),
154 'description' => ts('data associated with this group / name combo'),
155 'where' => 'civicrm_setting.value',
156 'table_name' => 'civicrm_setting',
157 'entity' => 'Setting',
158 'bao' => 'CRM_Core_BAO_Setting',
160 'serialize' => self
::SERIALIZE_PHP
,
163 'name' => 'domain_id',
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('Setting Domain'),
166 'description' => ts('Which Domain is this menu item for'),
168 'where' => 'civicrm_setting.domain_id',
169 'table_name' => 'civicrm_setting',
170 'entity' => 'Setting',
171 'bao' => 'CRM_Core_BAO_Setting',
173 'FKClassName' => 'CRM_Core_DAO_Domain',
174 'pseudoconstant' => [
175 'table' => 'civicrm_domain',
177 'labelColumn' => 'name',
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Setting Contact'),
184 'description' => ts('FK to Contact ID if the setting is localized to a contact'),
185 'where' => 'civicrm_setting.contact_id',
186 'table_name' => 'civicrm_setting',
187 'entity' => 'Setting',
188 'bao' => 'CRM_Core_BAO_Setting',
190 'FKClassName' => 'CRM_Contact_DAO_Contact',
193 'name' => 'is_domain',
194 'type' => CRM_Utils_Type
::T_BOOLEAN
,
195 'title' => ts('Is Domain Setting?'),
196 'description' => ts('Is this setting a contact specific or site wide setting?'),
197 'where' => 'civicrm_setting.is_domain',
198 'table_name' => 'civicrm_setting',
199 'entity' => 'Setting',
200 'bao' => 'CRM_Core_BAO_Setting',
204 'name' => 'component_id',
205 'type' => CRM_Utils_Type
::T_INT
,
206 'title' => ts('Setting Component'),
207 'description' => ts('Component that this menu item belongs to'),
208 'where' => 'civicrm_setting.component_id',
209 'table_name' => 'civicrm_setting',
210 'entity' => 'Setting',
211 'bao' => 'CRM_Core_BAO_Setting',
213 'FKClassName' => 'CRM_Core_DAO_Component',
217 'pseudoconstant' => [
218 'table' => 'civicrm_component',
220 'labelColumn' => 'name',
224 'name' => 'created_date',
225 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
226 'title' => ts('Setting Created Date'),
227 'description' => ts('When was the setting created'),
228 'where' => 'civicrm_setting.created_date',
229 'table_name' => 'civicrm_setting',
230 'entity' => 'Setting',
231 'bao' => 'CRM_Core_BAO_Setting',
235 'name' => 'created_id',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('Setting Created By'),
238 'description' => ts('FK to civicrm_contact, who created this setting'),
239 'where' => 'civicrm_setting.created_id',
240 'table_name' => 'civicrm_setting',
241 'entity' => 'Setting',
242 'bao' => 'CRM_Core_BAO_Setting',
244 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
249 return Civi
::$statics[__CLASS__
]['fields'];
253 * Return a mapping from field-name to the corresponding key (as used in fields()).
256 * Array(string $name => string $uniqueName).
258 public static function &fieldKeys() {
259 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
260 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
262 return Civi
::$statics[__CLASS__
]['fieldKeys'];
266 * Returns the names of this table
270 public static function getTableName() {
271 return self
::$_tableName;
275 * Returns if this table needs to be logged
279 public function getLog() {
284 * Returns the list of fields that can be imported
286 * @param bool $prefix
290 public static function &import($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'setting', $prefix, []);
296 * Returns the list of fields that can be exported
298 * @param bool $prefix
302 public static function &export($prefix = FALSE) {
303 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'setting', $prefix, []);
308 * Returns the list of indices
310 * @param bool $localize
314 public static function indices($localize = TRUE) {
316 'index_domain_contact_name' => [
317 'name' => 'index_domain_contact_name',
323 'localizable' => FALSE,
325 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
328 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;