Regen DAOs with new fieldKeys()
[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 FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = false;
63 /**
64 *
65 * @var int unsigned
66 */
67 public $id;
68 /**
69 * Unique name for setting
70 *
71 * @var string
72 */
73 public $name;
74 /**
75 * data associated with this group / name combo
76 *
77 * @var text
78 */
79 public $value;
80 /**
81 * Which Domain is this menu item for
82 *
83 * @var int unsigned
84 */
85 public $domain_id;
86 /**
87 * FK to Contact ID if the setting is localized to a contact
88 *
89 * @var int unsigned
90 */
91 public $contact_id;
92 /**
93 * Is this setting a contact specific or site wide setting?
94 *
95 * @var boolean
96 */
97 public $is_domain;
98 /**
99 * Component that this menu item belongs to
100 *
101 * @var int unsigned
102 */
103 public $component_id;
104 /**
105 * When was the setting created
106 *
107 * @var datetime
108 */
109 public $created_date;
110 /**
111 * FK to civicrm_contact, who created this setting
112 *
113 * @var int unsigned
114 */
115 public $created_id;
116 /**
117 * class constructor
118 *
119 * @return civicrm_setting
120 */
121 function __construct() {
122 $this->__table = 'civicrm_setting';
123 parent::__construct();
124 }
125 /**
126 * Returns foreign keys and entity references
127 *
128 * @return array
129 * [CRM_Core_Reference_Interface]
130 */
131 static function getReferenceColumns() {
132 if (!self::$_links) {
133 self::$_links = static ::createReferenceColumns(__CLASS__);
134 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
135 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
136 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id');
137 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
138 }
139 return self::$_links;
140 }
141 /**
142 * Returns all the column names of this table
143 *
144 * @return array
145 */
146 static function &fields() {
147 if (!(self::$_fields)) {
148 self::$_fields = array(
149 'id' => array(
150 'name' => 'id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Setting ID') ,
153 'required' => true,
154 ) ,
155 'name' => array(
156 'name' => 'name',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('Setting Name') ,
159 'description' => 'Unique name for setting',
160 'maxlength' => 255,
161 'size' => CRM_Utils_Type::HUGE,
162 ) ,
163 'value' => array(
164 'name' => 'value',
165 'type' => CRM_Utils_Type::T_TEXT,
166 'title' => ts('Value') ,
167 'description' => 'data associated with this group / name combo',
168 ) ,
169 'domain_id' => array(
170 'name' => 'domain_id',
171 'type' => CRM_Utils_Type::T_INT,
172 'title' => ts('Setting Domain') ,
173 'description' => 'Which Domain is this menu item for',
174 'required' => true,
175 'FKClassName' => 'CRM_Core_DAO_Domain',
176 'pseudoconstant' => array(
177 'table' => 'civicrm_domain',
178 'keyColumn' => 'id',
179 'labelColumn' => 'name',
180 )
181 ) ,
182 'contact_id' => array(
183 'name' => 'contact_id',
184 'type' => CRM_Utils_Type::T_INT,
185 'title' => ts('Setting Contact') ,
186 'description' => 'FK to Contact ID if the setting is localized to a contact',
187 'FKClassName' => 'CRM_Contact_DAO_Contact',
188 ) ,
189 'is_domain' => array(
190 'name' => 'is_domain',
191 'type' => CRM_Utils_Type::T_BOOLEAN,
192 'title' => ts('Is Domain Setting?') ,
193 'description' => 'Is this setting a contact specific or site wide setting?',
194 ) ,
195 'component_id' => array(
196 'name' => 'component_id',
197 'type' => CRM_Utils_Type::T_INT,
198 'title' => ts('Setting Component') ,
199 'description' => 'Component that this menu item belongs to',
200 'FKClassName' => 'CRM_Core_DAO_Component',
201 'html' => array(
202 'type' => 'Select',
203 ) ,
204 'pseudoconstant' => array(
205 'table' => 'civicrm_component',
206 'keyColumn' => 'id',
207 'labelColumn' => 'name',
208 )
209 ) ,
210 'created_date' => array(
211 'name' => 'created_date',
212 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
213 'title' => ts('Setting Created Date') ,
214 'description' => 'When was the setting created',
215 ) ,
216 'created_id' => array(
217 'name' => 'created_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Setting Created By') ,
220 'description' => 'FK to civicrm_contact, who created this setting',
221 'FKClassName' => 'CRM_Contact_DAO_Contact',
222 ) ,
223 );
224 }
225 return self::$_fields;
226 }
227 /**
228 * Return a mapping from field-name to the corresponding key (as used in fields()).
229 *
230 * @return array
231 * Array(string $name => string $uniqueName).
232 */
233 static function &fieldKeys() {
234 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
235 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
236 }
237 return Civi::$statics[__CLASS__]['fieldKeys'];
238 }
239 /**
240 * Returns the names of this table
241 *
242 * @return string
243 */
244 static function getTableName() {
245 return self::$_tableName;
246 }
247 /**
248 * Returns if this table needs to be logged
249 *
250 * @return boolean
251 */
252 function getLog() {
253 return self::$_log;
254 }
255 /**
256 * Returns the list of fields that can be imported
257 *
258 * @param bool $prefix
259 *
260 * @return array
261 */
262 static function &import($prefix = false) {
263 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array());
264 return $r;
265 }
266 /**
267 * Returns the list of fields that can be exported
268 *
269 * @param bool $prefix
270 *
271 * @return array
272 */
273 static function &export($prefix = false) {
274 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array());
275 return $r;
276 }
277 }