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:faec64e198a9187d40a3c1036a543d5c)
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?
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?'),
246 'where' => 'civicrm_setting.is_domain',
248 'table_name' => 'civicrm_setting',
249 'entity' => 'Setting',
250 'bao' => 'CRM_Core_BAO_Setting',
255 'name' => 'component_id',
256 'type' => CRM_Utils_Type
::T_INT
,
257 'title' => ts('Component ID'),
258 'description' => ts('Component that this menu item belongs to'),
259 'where' => 'civicrm_setting.component_id',
260 'table_name' => 'civicrm_setting',
261 'entity' => 'Setting',
262 'bao' => 'CRM_Core_BAO_Setting',
264 'FKClassName' => 'CRM_Core_DAO_Component',
267 'label' => ts("Component"),
269 'pseudoconstant' => [
270 'table' => 'civicrm_component',
272 'labelColumn' => 'name',
277 'name' => 'created_date',
278 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
279 'title' => ts('Setting Created Date'),
280 'description' => ts('When was the setting created'),
281 'where' => 'civicrm_setting.created_date',
282 'table_name' => 'civicrm_setting',
283 'entity' => 'Setting',
284 'bao' => 'CRM_Core_BAO_Setting',
289 'name' => 'created_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Created By Contact ID'),
292 'description' => ts('FK to civicrm_contact, who created this setting'),
293 'where' => 'civicrm_setting.created_id',
294 'table_name' => 'civicrm_setting',
295 'entity' => 'Setting',
296 'bao' => 'CRM_Core_BAO_Setting',
298 'FKClassName' => 'CRM_Contact_DAO_Contact',
300 'label' => ts("Created By"),
305 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
307 return Civi
::$statics[__CLASS__
]['fields'];
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
314 * Array(string $name => string $uniqueName).
316 public static function &fieldKeys() {
317 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
318 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
320 return Civi
::$statics[__CLASS__
]['fieldKeys'];
324 * Returns the names of this table
328 public static function getTableName() {
329 return self
::$_tableName;
333 * Returns if this table needs to be logged
337 public function getLog() {
342 * Returns the list of fields that can be imported
344 * @param bool $prefix
348 public static function &import($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'setting', $prefix, []);
354 * Returns the list of fields that can be exported
356 * @param bool $prefix
360 public static function &export($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'setting', $prefix, []);
366 * Returns the list of indices
368 * @param bool $localize
372 public static function indices($localize = TRUE) {
374 'index_domain_contact_name' => [
375 'name' => 'index_domain_contact_name',
381 'localizable' => FALSE,
383 'sig' => 'civicrm_setting::1::domain_id::contact_id::name',
386 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;