API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Contribute / DAO / ContributionSoft.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a1c2918874b74f3f9bbbe0464aea1563)
10 */
11
12 /**
13 * Database access object for the ContributionSoft entity.
14 */
15 class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_contribution_soft';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Soft Contribution ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to contribution table.
40 *
41 * @var int
42 */
43 public $contribution_id;
44
45 /**
46 * FK to Contact ID
47 *
48 * @var int
49 */
50 public $contact_id;
51
52 /**
53 * Amount of this soft contribution.
54 *
55 * @var float
56 */
57 public $amount;
58
59 /**
60 * 3 character string, value from config setting or input via user.
61 *
62 * @var string
63 */
64 public $currency;
65
66 /**
67 * FK to civicrm_pcp.id
68 *
69 * @var int
70 */
71 public $pcp_id;
72
73 /**
74 * @var bool
75 */
76 public $pcp_display_in_roll;
77
78 /**
79 * @var string
80 */
81 public $pcp_roll_nickname;
82
83 /**
84 * @var string
85 */
86 public $pcp_personal_note;
87
88 /**
89 * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
90 *
91 * @var int
92 */
93 public $soft_credit_type_id;
94
95 /**
96 * Class constructor.
97 */
98 public function __construct() {
99 $this->__table = 'civicrm_contribution_soft';
100 parent::__construct();
101 }
102
103 /**
104 * Returns localized title of this entity.
105 */
106 public static function getEntityTitle() {
107 return ts('Contribution Softs');
108 }
109
110 /**
111 * Returns foreign keys and entity references.
112 *
113 * @return array
114 * [CRM_Core_Reference_Interface]
115 */
116 public static function getReferenceColumns() {
117 if (!isset(Civi::$statics[__CLASS__]['links'])) {
118 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pcp_id', 'civicrm_pcp', 'id');
122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
123 }
124 return Civi::$statics[__CLASS__]['links'];
125 }
126
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 public static function &fields() {
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = [
135 'contribution_soft_id' => [
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Soft Contribution ID'),
139 'description' => ts('Soft Contribution ID'),
140 'required' => TRUE,
141 'import' => TRUE,
142 'where' => 'civicrm_contribution_soft.id',
143 'export' => TRUE,
144 'table_name' => 'civicrm_contribution_soft',
145 'entity' => 'ContributionSoft',
146 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
147 'localizable' => 0,
148 'add' => '2.2',
149 ],
150 'contribution_id' => [
151 'name' => 'contribution_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Soft Contribution - Contribution'),
154 'description' => ts('FK to contribution table.'),
155 'required' => TRUE,
156 'where' => 'civicrm_contribution_soft.contribution_id',
157 'table_name' => 'civicrm_contribution_soft',
158 'entity' => 'ContributionSoft',
159 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
160 'localizable' => 0,
161 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
162 'add' => '2.2',
163 ],
164 'contribution_soft_contact_id' => [
165 'name' => 'contact_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Contact ID'),
168 'description' => ts('FK to Contact ID'),
169 'required' => TRUE,
170 'import' => TRUE,
171 'where' => 'civicrm_contribution_soft.contact_id',
172 'headerPattern' => '/contact(.?id)?/i',
173 'dataPattern' => '/^\d+$/',
174 'export' => TRUE,
175 'table_name' => 'civicrm_contribution_soft',
176 'entity' => 'ContributionSoft',
177 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
178 'localizable' => 0,
179 'FKClassName' => 'CRM_Contact_DAO_Contact',
180 'add' => '2.2',
181 ],
182 'amount' => [
183 'name' => 'amount',
184 'type' => CRM_Utils_Type::T_MONEY,
185 'title' => ts('Soft Contribution Amount'),
186 'description' => ts('Amount of this soft contribution.'),
187 'required' => TRUE,
188 'precision' => [
189 20,
190 2,
191 ],
192 'import' => TRUE,
193 'where' => 'civicrm_contribution_soft.amount',
194 'headerPattern' => '/total(.?am(ou)?nt)?/i',
195 'dataPattern' => '/^\d+(\.\d{2})?$/',
196 'export' => TRUE,
197 'table_name' => 'civicrm_contribution_soft',
198 'entity' => 'ContributionSoft',
199 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
200 'localizable' => 0,
201 'add' => '2.2',
202 ],
203 'currency' => [
204 'name' => 'currency',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('Soft Contribution Currency'),
207 'description' => ts('3 character string, value from config setting or input via user.'),
208 'maxlength' => 3,
209 'size' => CRM_Utils_Type::FOUR,
210 'where' => 'civicrm_contribution_soft.currency',
211 'default' => 'NULL',
212 'table_name' => 'civicrm_contribution_soft',
213 'entity' => 'ContributionSoft',
214 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
215 'localizable' => 0,
216 'html' => [
217 'type' => 'Select',
218 ],
219 'pseudoconstant' => [
220 'table' => 'civicrm_currency',
221 'keyColumn' => 'name',
222 'labelColumn' => 'full_name',
223 'nameColumn' => 'name',
224 'abbrColumn' => 'symbol',
225 ],
226 'add' => '3.2',
227 ],
228 'pcp_id' => [
229 'name' => 'pcp_id',
230 'type' => CRM_Utils_Type::T_INT,
231 'title' => ts('Soft Contribution PCP'),
232 'description' => ts('FK to civicrm_pcp.id'),
233 'where' => 'civicrm_contribution_soft.pcp_id',
234 'default' => 'NULL',
235 'table_name' => 'civicrm_contribution_soft',
236 'entity' => 'ContributionSoft',
237 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
238 'localizable' => 0,
239 'FKClassName' => 'CRM_PCP_DAO_PCP',
240 'pseudoconstant' => [
241 'table' => 'civicrm_pcp',
242 'keyColumn' => 'id',
243 'labelColumn' => 'title',
244 ],
245 'add' => '2.2',
246 ],
247 'pcp_display_in_roll' => [
248 'name' => 'pcp_display_in_roll',
249 'type' => CRM_Utils_Type::T_BOOLEAN,
250 'title' => ts('Soft Contribution Display on PCP'),
251 'where' => 'civicrm_contribution_soft.pcp_display_in_roll',
252 'default' => '0',
253 'table_name' => 'civicrm_contribution_soft',
254 'entity' => 'ContributionSoft',
255 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
256 'localizable' => 0,
257 'add' => '2.2',
258 ],
259 'pcp_roll_nickname' => [
260 'name' => 'pcp_roll_nickname',
261 'type' => CRM_Utils_Type::T_STRING,
262 'title' => ts('Soft Contribution PCP Nickname'),
263 'maxlength' => 255,
264 'size' => CRM_Utils_Type::HUGE,
265 'where' => 'civicrm_contribution_soft.pcp_roll_nickname',
266 'default' => 'NULL',
267 'table_name' => 'civicrm_contribution_soft',
268 'entity' => 'ContributionSoft',
269 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
270 'localizable' => 0,
271 'add' => '2.2',
272 ],
273 'pcp_personal_note' => [
274 'name' => 'pcp_personal_note',
275 'type' => CRM_Utils_Type::T_STRING,
276 'title' => ts('Soft Contribution PCP Note'),
277 'maxlength' => 255,
278 'size' => CRM_Utils_Type::HUGE,
279 'where' => 'civicrm_contribution_soft.pcp_personal_note',
280 'default' => 'NULL',
281 'table_name' => 'civicrm_contribution_soft',
282 'entity' => 'ContributionSoft',
283 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
284 'localizable' => 0,
285 'html' => [
286 'type' => 'TextArea',
287 ],
288 'add' => '2.2',
289 ],
290 'soft_credit_type_id' => [
291 'name' => 'soft_credit_type_id',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Soft Credit Type'),
294 'description' => ts('Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.'),
295 'where' => 'civicrm_contribution_soft.soft_credit_type_id',
296 'default' => 'NULL',
297 'table_name' => 'civicrm_contribution_soft',
298 'entity' => 'ContributionSoft',
299 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
300 'localizable' => 0,
301 'pseudoconstant' => [
302 'optionGroupName' => 'soft_credit_type',
303 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
304 ],
305 'add' => '2.2',
306 ],
307 ];
308 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
309 }
310 return Civi::$statics[__CLASS__]['fields'];
311 }
312
313 /**
314 * Return a mapping from field-name to the corresponding key (as used in fields()).
315 *
316 * @return array
317 * Array(string $name => string $uniqueName).
318 */
319 public static function &fieldKeys() {
320 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
321 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
322 }
323 return Civi::$statics[__CLASS__]['fieldKeys'];
324 }
325
326 /**
327 * Returns the names of this table
328 *
329 * @return string
330 */
331 public static function getTableName() {
332 return self::$_tableName;
333 }
334
335 /**
336 * Returns if this table needs to be logged
337 *
338 * @return bool
339 */
340 public function getLog() {
341 return self::$_log;
342 }
343
344 /**
345 * Returns the list of fields that can be imported
346 *
347 * @param bool $prefix
348 *
349 * @return array
350 */
351 public static function &import($prefix = FALSE) {
352 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, []);
353 return $r;
354 }
355
356 /**
357 * Returns the list of fields that can be exported
358 *
359 * @param bool $prefix
360 *
361 * @return array
362 */
363 public static function &export($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, []);
365 return $r;
366 }
367
368 /**
369 * Returns the list of indices
370 *
371 * @param bool $localize
372 *
373 * @return array
374 */
375 public static function indices($localize = TRUE) {
376 $indices = [
377 'index_id' => [
378 'name' => 'index_id',
379 'field' => [
380 0 => 'pcp_id',
381 ],
382 'localizable' => FALSE,
383 'sig' => 'civicrm_contribution_soft::0::pcp_id',
384 ],
385 ];
386 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
387 }
388
389 }