Regen DAOs with new fieldKeys()
[civicrm-core.git] / CRM / Contribute / DAO / ContributionSoft.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/Contribute/ContributionSoft.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:ea8abcdf53630758c538439bb186c717)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_contribution_soft';
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 = true;
63 /**
64 * Soft Contribution ID
65 *
66 * @var int unsigned
67 */
68 public $id;
69 /**
70 * FK to contribution table.
71 *
72 * @var int unsigned
73 */
74 public $contribution_id;
75 /**
76 * FK to Contact ID
77 *
78 * @var int unsigned
79 */
80 public $contact_id;
81 /**
82 * Amount of this soft contribution.
83 *
84 * @var float
85 */
86 public $amount;
87 /**
88 * 3 character string, value from config setting or input via user.
89 *
90 * @var string
91 */
92 public $currency;
93 /**
94 * FK to civicrm_pcp.id
95 *
96 * @var int unsigned
97 */
98 public $pcp_id;
99 /**
100 *
101 * @var boolean
102 */
103 public $pcp_display_in_roll;
104 /**
105 *
106 * @var string
107 */
108 public $pcp_roll_nickname;
109 /**
110 *
111 * @var string
112 */
113 public $pcp_personal_note;
114 /**
115 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
116 *
117 * @var int unsigned
118 */
119 public $soft_credit_type_id;
120 /**
121 * class constructor
122 *
123 * @return civicrm_contribution_soft
124 */
125 function __construct() {
126 $this->__table = 'civicrm_contribution_soft';
127 parent::__construct();
128 }
129 /**
130 * Returns foreign keys and entity references
131 *
132 * @return array
133 * [CRM_Core_Reference_Interface]
134 */
135 static function getReferenceColumns() {
136 if (!self::$_links) {
137 self::$_links = static ::createReferenceColumns(__CLASS__);
138 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id');
139 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
140 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pcp_id', 'civicrm_pcp', 'id');
141 }
142 return self::$_links;
143 }
144 /**
145 * Returns all the column names of this table
146 *
147 * @return array
148 */
149 static function &fields() {
150 if (!(self::$_fields)) {
151 self::$_fields = array(
152 'contribution_soft_id' => array(
153 'name' => 'id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Soft Contribution ID') ,
156 'description' => 'Soft Contribution ID',
157 'required' => true,
158 'import' => true,
159 'where' => 'civicrm_contribution_soft.id',
160 'headerPattern' => '',
161 'dataPattern' => '',
162 'export' => true,
163 ) ,
164 'contribution_id' => array(
165 'name' => 'contribution_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Soft Contribution - Contribution') ,
168 'description' => 'FK to contribution table.',
169 'required' => true,
170 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
171 ) ,
172 'contribution_soft_contact_id' => array(
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Contact ID') ,
176 'description' => 'FK to Contact ID',
177 'required' => true,
178 'import' => true,
179 'where' => 'civicrm_contribution_soft.contact_id',
180 'headerPattern' => '/contact(.?id)?/i',
181 'dataPattern' => '/^\d+$/',
182 'export' => true,
183 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 ) ,
185 'amount' => array(
186 'name' => 'amount',
187 'type' => CRM_Utils_Type::T_MONEY,
188 'title' => ts('Soft Contribution Amount') ,
189 'description' => 'Amount of this soft contribution.',
190 'required' => true,
191 'precision' => array(
192 20,
193 2
194 ) ,
195 'import' => true,
196 'where' => 'civicrm_contribution_soft.amount',
197 'headerPattern' => '/total(.?am(ou)?nt)?/i',
198 'dataPattern' => '/^\d+(\.\d{2})?$/',
199 'export' => true,
200 ) ,
201 'currency' => array(
202 'name' => 'currency',
203 'type' => CRM_Utils_Type::T_STRING,
204 'title' => ts('Soft Contribution Currency') ,
205 'description' => '3 character string, value from config setting or input via user.',
206 'maxlength' => 3,
207 'size' => CRM_Utils_Type::FOUR,
208 'default' => 'NULL',
209 'html' => array(
210 'type' => 'Select',
211 ) ,
212 'pseudoconstant' => array(
213 'table' => 'civicrm_currency',
214 'keyColumn' => 'name',
215 'labelColumn' => 'full_name',
216 'nameColumn' => 'name',
217 )
218 ) ,
219 'pcp_id' => array(
220 'name' => 'pcp_id',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Soft Contribution PCP') ,
223 'description' => 'FK to civicrm_pcp.id',
224 'default' => 'NULL',
225 'FKClassName' => 'CRM_PCP_DAO_PCP',
226 'pseudoconstant' => array(
227 'table' => 'civicrm_pcp',
228 'keyColumn' => 'id',
229 'labelColumn' => 'title',
230 )
231 ) ,
232 'pcp_display_in_roll' => array(
233 'name' => 'pcp_display_in_roll',
234 'type' => CRM_Utils_Type::T_BOOLEAN,
235 'title' => ts('Soft Contribution Display on PCP') ,
236 ) ,
237 'pcp_roll_nickname' => array(
238 'name' => 'pcp_roll_nickname',
239 'type' => CRM_Utils_Type::T_STRING,
240 'title' => ts('Soft Contribution PCP Nickname') ,
241 'maxlength' => 255,
242 'size' => CRM_Utils_Type::HUGE,
243 'default' => 'NULL',
244 ) ,
245 'pcp_personal_note' => array(
246 'name' => 'pcp_personal_note',
247 'type' => CRM_Utils_Type::T_STRING,
248 'title' => ts('Soft Contribution PCP Note') ,
249 'maxlength' => 255,
250 'size' => CRM_Utils_Type::HUGE,
251 'default' => 'NULL',
252 ) ,
253 'soft_credit_type_id' => array(
254 'name' => 'soft_credit_type_id',
255 'type' => CRM_Utils_Type::T_INT,
256 'title' => ts('Soft Credit Type') ,
257 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.',
258 'default' => 'NULL',
259 'pseudoconstant' => array(
260 'optionGroupName' => 'soft_credit_type',
261 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
262 )
263 ) ,
264 );
265 }
266 return self::$_fields;
267 }
268 /**
269 * Return a mapping from field-name to the corresponding key (as used in fields()).
270 *
271 * @return array
272 * Array(string $name => string $uniqueName).
273 */
274 static function &fieldKeys() {
275 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
276 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
277 }
278 return Civi::$statics[__CLASS__]['fieldKeys'];
279 }
280 /**
281 * Returns the names of this table
282 *
283 * @return string
284 */
285 static function getTableName() {
286 return self::$_tableName;
287 }
288 /**
289 * Returns if this table needs to be logged
290 *
291 * @return boolean
292 */
293 function getLog() {
294 return self::$_log;
295 }
296 /**
297 * Returns the list of fields that can be imported
298 *
299 * @param bool $prefix
300 *
301 * @return array
302 */
303 static function &import($prefix = false) {
304 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, array());
305 return $r;
306 }
307 /**
308 * Returns the list of fields that can be exported
309 *
310 * @param bool $prefix
311 *
312 * @return array
313 */
314 static function &export($prefix = false) {
315 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, array());
316 return $r;
317 }
318 }