5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/Setting.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:5aa73137509e3760555c0f3d1d746b05)
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 static $_tableName = 'civicrm_setting';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_setting',
132 'entity' => 'Setting',
133 'bao' => 'CRM_Core_BAO_Setting',
138 'type' => CRM_Utils_Type
::T_STRING
,
139 'title' => ts('Setting Name'),
140 'description' => 'Unique name for setting',
142 'size' => CRM_Utils_Type
::HUGE
,
143 'table_name' => 'civicrm_setting',
144 'entity' => 'Setting',
145 'bao' => 'CRM_Core_BAO_Setting',
150 'type' => CRM_Utils_Type
::T_TEXT
,
151 'title' => ts('Value'),
152 'description' => 'data associated with this group / name combo',
153 'table_name' => 'civicrm_setting',
154 'entity' => 'Setting',
155 'bao' => 'CRM_Core_BAO_Setting',
157 'serialize' => self
::SERIALIZE_PHP
,
160 'name' => 'domain_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Setting Domain'),
163 'description' => 'Which Domain is this menu item for',
165 'table_name' => 'civicrm_setting',
166 'entity' => 'Setting',
167 'bao' => 'CRM_Core_BAO_Setting',
169 'FKClassName' => 'CRM_Core_DAO_Domain',
170 'pseudoconstant' => [
171 'table' => 'civicrm_domain',
173 'labelColumn' => 'name',
177 'name' => 'contact_id',
178 'type' => CRM_Utils_Type
::T_INT
,
179 'title' => ts('Setting Contact'),
180 'description' => 'FK to Contact ID if the setting is localized to a contact',
181 'table_name' => 'civicrm_setting',
182 'entity' => 'Setting',
183 'bao' => 'CRM_Core_BAO_Setting',
185 'FKClassName' => 'CRM_Contact_DAO_Contact',
188 'name' => 'is_domain',
189 'type' => CRM_Utils_Type
::T_BOOLEAN
,
190 'title' => ts('Is Domain Setting?'),
191 'description' => 'Is this setting a contact specific or site wide setting?',
192 'table_name' => 'civicrm_setting',
193 'entity' => 'Setting',
194 'bao' => 'CRM_Core_BAO_Setting',
198 'name' => 'component_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Setting Component'),
201 'description' => 'Component that this menu item belongs to',
202 'table_name' => 'civicrm_setting',
203 'entity' => 'Setting',
204 'bao' => 'CRM_Core_BAO_Setting',
206 'FKClassName' => 'CRM_Core_DAO_Component',
210 'pseudoconstant' => [
211 'table' => 'civicrm_component',
213 'labelColumn' => 'name',
217 'name' => 'created_date',
218 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
219 'title' => ts('Setting Created Date'),
220 'description' => 'When was the setting created',
221 'table_name' => 'civicrm_setting',
222 'entity' => 'Setting',
223 'bao' => 'CRM_Core_BAO_Setting',
227 'name' => 'created_id',
228 'type' => CRM_Utils_Type
::T_INT
,
229 'title' => ts('Setting Created By'),
230 'description' => 'FK to civicrm_contact, who created this setting',
231 'table_name' => 'civicrm_setting',
232 'entity' => 'Setting',
233 'bao' => 'CRM_Core_BAO_Setting',
235 'FKClassName' => 'CRM_Contact_DAO_Contact',
238 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
240 return Civi
::$statics[__CLASS__
]['fields'];
244 * Return a mapping from field-name to the corresponding key (as used in fields()).
247 * Array(string $name => string $uniqueName).
249 public static function &fieldKeys() {
250 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
251 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
253 return Civi
::$statics[__CLASS__
]['fieldKeys'];
257 * Returns the names of this table
261 public static function getTableName() {
262 return self
::$_tableName;
266 * Returns if this table needs to be logged
270 public function getLog() {
275 * Returns the list of fields that can be imported
277 * @param bool $prefix
281 public static function &import($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'setting', $prefix, []);
287 * Returns the list of fields that can be exported
289 * @param bool $prefix
293 public static function &export($prefix = FALSE) {
294 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'setting', $prefix, []);
299 * Returns the list of indices
301 * @param bool $localize
305 public static function indices($localize = TRUE) {
307 'index_domain_contact_name' => [
308 'name' => 'index_domain_contact_name',
314 'localizable' => FALSE,
316 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
319 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;