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