CRM-20312 regenerated DAO with localisation
[civicrm-core.git] / CRM / Core / DAO / Setting.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/Setting.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:03045a230d0ba9aa60bf9dd4818cb12e)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_Setting constructor.
39 */
40 class CRM_Core_DAO_Setting extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_setting';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Unique name for setting
60 *
61 * @var string
62 */
63 public $name;
64 /**
65 * data associated with this group / name combo
66 *
67 * @var text
68 */
69 public $value;
70 /**
71 * Which Domain is this menu item for
72 *
73 * @var int unsigned
74 */
75 public $domain_id;
76 /**
77 * FK to Contact ID if the setting is localized to a contact
78 *
79 * @var int unsigned
80 */
81 public $contact_id;
82 /**
83 * Is this setting a contact specific or site wide setting?
84 *
85 * @var boolean
86 */
87 public $is_domain;
88 /**
89 * Component that this menu item belongs to
90 *
91 * @var int unsigned
92 */
93 public $component_id;
94 /**
95 * When was the setting created
96 *
97 * @var datetime
98 */
99 public $created_date;
100 /**
101 * FK to civicrm_contact, who created this setting
102 *
103 * @var int unsigned
104 */
105 public $created_id;
106 /**
107 * Class constructor.
108 */
109 function __construct() {
110 $this->__table = 'civicrm_setting';
111 parent::__construct();
112 }
113 /**
114 * Returns foreign keys and entity references.
115 *
116 * @return array
117 * [CRM_Core_Reference_Interface]
118 */
119 static function getReferenceColumns() {
120 if (!isset(Civi::$statics[__CLASS__]['links'])) {
121 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
122 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
124 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
125 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
126 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
127 }
128 return Civi::$statics[__CLASS__]['links'];
129 }
130 /**
131 * Returns all the column names of this table
132 *
133 * @return array
134 */
135 static function &fields() {
136 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
137 Civi::$statics[__CLASS__]['fields'] = array(
138 'id' => array(
139 'name' => 'id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Setting ID') ,
142 'required' => true,
143 'table_name' => 'civicrm_setting',
144 'entity' => 'Setting',
145 'bao' => 'CRM_Core_BAO_Setting',
146 'localizable' => 0,
147 ) ,
148 'name' => array(
149 'name' => 'name',
150 'type' => CRM_Utils_Type::T_STRING,
151 'title' => ts('Setting Name') ,
152 'description' => 'Unique name for setting',
153 'maxlength' => 255,
154 'size' => CRM_Utils_Type::HUGE,
155 'table_name' => 'civicrm_setting',
156 'entity' => 'Setting',
157 'bao' => 'CRM_Core_BAO_Setting',
158 'localizable' => 0,
159 ) ,
160 'value' => array(
161 'name' => 'value',
162 'type' => CRM_Utils_Type::T_TEXT,
163 'title' => ts('Value') ,
164 'description' => 'data associated with this group / name combo',
165 'table_name' => 'civicrm_setting',
166 'entity' => 'Setting',
167 'bao' => 'CRM_Core_BAO_Setting',
168 'localizable' => 0,
169 ) ,
170 'domain_id' => array(
171 'name' => 'domain_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Setting Domain') ,
174 'description' => 'Which Domain is this menu item for',
175 'required' => true,
176 'table_name' => 'civicrm_setting',
177 'entity' => 'Setting',
178 'bao' => 'CRM_Core_BAO_Setting',
179 'localizable' => 0,
180 'FKClassName' => 'CRM_Core_DAO_Domain',
181 'pseudoconstant' => array(
182 'table' => 'civicrm_domain',
183 'keyColumn' => 'id',
184 'labelColumn' => 'name',
185 )
186 ) ,
187 'contact_id' => array(
188 'name' => 'contact_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Setting Contact') ,
191 'description' => 'FK to Contact ID if the setting is localized to a contact',
192 'table_name' => 'civicrm_setting',
193 'entity' => 'Setting',
194 'bao' => 'CRM_Core_BAO_Setting',
195 'localizable' => 0,
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
197 ) ,
198 'is_domain' => array(
199 'name' => 'is_domain',
200 'type' => CRM_Utils_Type::T_BOOLEAN,
201 'title' => ts('Is Domain Setting?') ,
202 'description' => 'Is this setting a contact specific or site wide setting?',
203 'table_name' => 'civicrm_setting',
204 'entity' => 'Setting',
205 'bao' => 'CRM_Core_BAO_Setting',
206 'localizable' => 0,
207 ) ,
208 'component_id' => array(
209 'name' => 'component_id',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Setting Component') ,
212 'description' => 'Component that this menu item belongs to',
213 'table_name' => 'civicrm_setting',
214 'entity' => 'Setting',
215 'bao' => 'CRM_Core_BAO_Setting',
216 'localizable' => 0,
217 'FKClassName' => 'CRM_Core_DAO_Component',
218 'html' => array(
219 'type' => 'Select',
220 ) ,
221 'pseudoconstant' => array(
222 'table' => 'civicrm_component',
223 'keyColumn' => 'id',
224 'labelColumn' => 'name',
225 )
226 ) ,
227 'created_date' => array(
228 'name' => 'created_date',
229 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
230 'title' => ts('Setting Created Date') ,
231 'description' => 'When was the setting created',
232 'table_name' => 'civicrm_setting',
233 'entity' => 'Setting',
234 'bao' => 'CRM_Core_BAO_Setting',
235 'localizable' => 0,
236 ) ,
237 'created_id' => array(
238 'name' => 'created_id',
239 'type' => CRM_Utils_Type::T_INT,
240 'title' => ts('Setting Created By') ,
241 'description' => 'FK to civicrm_contact, who created this setting',
242 'table_name' => 'civicrm_setting',
243 'entity' => 'Setting',
244 'bao' => 'CRM_Core_BAO_Setting',
245 'localizable' => 0,
246 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 ) ,
248 );
249 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
250 }
251 return Civi::$statics[__CLASS__]['fields'];
252 }
253 /**
254 * Return a mapping from field-name to the corresponding key (as used in fields()).
255 *
256 * @return array
257 * Array(string $name => string $uniqueName).
258 */
259 static function &fieldKeys() {
260 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
261 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
262 }
263 return Civi::$statics[__CLASS__]['fieldKeys'];
264 }
265 /**
266 * Returns the names of this table
267 *
268 * @return string
269 */
270 static function getTableName() {
271 return self::$_tableName;
272 }
273 /**
274 * Returns if this table needs to be logged
275 *
276 * @return boolean
277 */
278 function getLog() {
279 return self::$_log;
280 }
281 /**
282 * Returns the list of fields that can be imported
283 *
284 * @param bool $prefix
285 *
286 * @return array
287 */
288 static function &import($prefix = false) {
289 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array());
290 return $r;
291 }
292 /**
293 * Returns the list of fields that can be exported
294 *
295 * @param bool $prefix
296 *
297 * @return array
298 */
299 static function &export($prefix = false) {
300 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array());
301 return $r;
302 }
303 }