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