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