Regen DAOs with new import() / export()
[civicrm-core.git] / CRM / Core / DAO / Setting.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Core/Setting.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:cc5f4aca441eb6d874c637a53cabddd8)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_Setting extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_setting';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 *
71 * @var int unsigned
72 */
73 public $id;
74 /**
75 * Unique name for setting
76 *
77 * @var string
78 */
79 public $name;
80 /**
81 * data associated with this group / name combo
82 *
83 * @var text
84 */
85 public $value;
86 /**
87 * Which Domain is this menu item for
88 *
89 * @var int unsigned
90 */
91 public $domain_id;
92 /**
93 * FK to Contact ID if the setting is localized to a contact
94 *
95 * @var int unsigned
96 */
97 public $contact_id;
98 /**
99 * Is this setting a contact specific or site wide setting?
100 *
101 * @var boolean
102 */
103 public $is_domain;
104 /**
105 * Component that this menu item belongs to
106 *
107 * @var int unsigned
108 */
109 public $component_id;
110 /**
111 * When was the setting created
112 *
113 * @var datetime
114 */
115 public $created_date;
116 /**
117 * FK to civicrm_contact, who created this setting
118 *
119 * @var int unsigned
120 */
121 public $created_id;
122 /**
123 * class constructor
124 *
125 * @return civicrm_setting
126 */
127 function __construct() {
128 $this->__table = 'civicrm_setting';
129 parent::__construct();
130 }
131 /**
132 * Returns foreign keys and entity references
133 *
134 * @return array
135 * [CRM_Core_Reference_Interface]
136 */
137 static function getReferenceColumns() {
138 if (!self::$_links) {
139 self::$_links = static ::createReferenceColumns(__CLASS__);
140 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
141 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
142 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
143 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
144 }
145 return self::$_links;
146 }
147 /**
148 * Returns all the column names of this table
149 *
150 * @return array
151 */
152 static function &fields() {
153 if (!(self::$_fields)) {
154 self::$_fields = array(
155 'id' => array(
156 'name' => 'id',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('Setting ID') ,
159 'required' => true,
160 ) ,
161 'name' => array(
162 'name' => 'name',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Setting Name') ,
165 'description' => 'Unique name for setting',
166 'maxlength' => 255,
167 'size' => CRM_Utils_Type::HUGE,
168 ) ,
169 'value' => array(
170 'name' => 'value',
171 'type' => CRM_Utils_Type::T_TEXT,
172 'title' => ts('Value') ,
173 'description' => 'data associated with this group / name combo',
174 ) ,
175 'domain_id' => array(
176 'name' => 'domain_id',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Setting Domain') ,
179 'description' => 'Which Domain is this menu item for',
180 'required' => true,
181 'FKClassName' => 'CRM_Core_DAO_Domain',
182 'pseudoconstant' => array(
183 'table' => 'civicrm_domain',
184 'keyColumn' => 'id',
185 'labelColumn' => 'name',
186 )
187 ) ,
188 'contact_id' => array(
189 'name' => 'contact_id',
190 'type' => CRM_Utils_Type::T_INT,
191 'title' => ts('Setting Contact') ,
192 'description' => 'FK to Contact ID if the setting is localized to a contact',
193 'FKClassName' => 'CRM_Contact_DAO_Contact',
194 ) ,
195 'is_domain' => array(
196 'name' => 'is_domain',
197 'type' => CRM_Utils_Type::T_BOOLEAN,
198 'title' => ts('Is Domain Setting?') ,
199 'description' => 'Is this setting a contact specific or site wide setting?',
200 ) ,
201 'component_id' => array(
202 'name' => 'component_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Setting Component') ,
205 'description' => 'Component that this menu item belongs to',
206 'FKClassName' => 'CRM_Core_DAO_Component',
207 'html' => array(
208 'type' => 'Select',
209 ) ,
210 'pseudoconstant' => array(
211 'table' => 'civicrm_component',
212 'keyColumn' => 'id',
213 'labelColumn' => 'name',
214 )
215 ) ,
216 'created_date' => array(
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 ) ,
222 'created_id' => array(
223 'name' => 'created_id',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('Setting Created By') ,
226 'description' => 'FK to civicrm_contact, who created this setting',
227 'FKClassName' => 'CRM_Contact_DAO_Contact',
228 ) ,
229 );
230 }
231 return self::$_fields;
232 }
233 /**
234 * Returns an array containing, for each field, the arary key used for that
235 * field in self::$_fields.
236 *
237 * @return array
238 */
239 static function &fieldKeys() {
240 if (!(self::$_fieldKeys)) {
241 self::$_fieldKeys = array(
242 'id' => 'id',
243 'name' => 'name',
244 'value' => 'value',
245 'domain_id' => 'domain_id',
246 'contact_id' => 'contact_id',
247 'is_domain' => 'is_domain',
248 'component_id' => 'component_id',
249 'created_date' => 'created_date',
250 'created_id' => 'created_id',
251 );
252 }
253 return self::$_fieldKeys;
254 }
255 /**
256 * Returns the names of this table
257 *
258 * @return string
259 */
260 static function getTableName() {
261 return self::$_tableName;
262 }
263 /**
264 * Returns if this table needs to be logged
265 *
266 * @return boolean
267 */
268 function getLog() {
269 return self::$_log;
270 }
271 /**
272 * Returns the list of fields that can be imported
273 *
274 * @param bool $prefix
275 *
276 * @return array
277 */
278 static function &import($prefix = false) {
279 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array());
280 return $r;
281 }
282 /**
283 * Returns the list of fields that can be exported
284 *
285 * @param bool $prefix
286 *
287 * @return array
288 */
289 static function &export($prefix = false) {
290 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array());
291 return $r;
292 }
293 }