Reformat DAO files to pass linting and use short array syntax
[civicrm-core.git] / CRM / Contribute / DAO / ContributionSoft.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2017
6 *
7 * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:eb1e493dc7ff4da34167ad0828d61fd4)
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 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 static $_log = TRUE;
30
31 /**
32 * Soft Contribution ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * FK to contribution table.
40 *
41 * @var int unsigned
42 */
43 public $contribution_id;
44
45 /**
46 * FK to Contact ID
47 *
48 * @var int unsigned
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 unsigned
70 */
71 public $pcp_id;
72
73 /**
74 * @var boolean
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 unsigned
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 foreign keys and entity references.
105 *
106 * @return array
107 * [CRM_Core_Reference_Interface]
108 */
109 public static function getReferenceColumns() {
110 if (!isset(Civi::$statics[__CLASS__]['links'])) {
111 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
112 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
113 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pcp_id', 'civicrm_pcp', 'id');
115 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
116 }
117 return Civi::$statics[__CLASS__]['links'];
118 }
119
120 /**
121 * Returns all the column names of this table
122 *
123 * @return array
124 */
125 public static function &fields() {
126 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
127 Civi::$statics[__CLASS__]['fields'] = [
128 'contribution_soft_id' => [
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Soft Contribution ID'),
132 'description' => 'Soft Contribution ID',
133 'required' => TRUE,
134 'import' => TRUE,
135 'where' => 'civicrm_contribution_soft.id',
136 'headerPattern' => '',
137 'dataPattern' => '',
138 'export' => TRUE,
139 'table_name' => 'civicrm_contribution_soft',
140 'entity' => 'ContributionSoft',
141 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
142 'localizable' => 0,
143 ],
144 'contribution_id' => [
145 'name' => 'contribution_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Soft Contribution - Contribution'),
148 'description' => 'FK to contribution table.',
149 'required' => TRUE,
150 'table_name' => 'civicrm_contribution_soft',
151 'entity' => 'ContributionSoft',
152 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
153 'localizable' => 0,
154 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
155 ],
156 'contribution_soft_contact_id' => [
157 'name' => 'contact_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Contact ID'),
160 'description' => 'FK to Contact ID',
161 'required' => TRUE,
162 'import' => TRUE,
163 'where' => 'civicrm_contribution_soft.contact_id',
164 'headerPattern' => '/contact(.?id)?/i',
165 'dataPattern' => '/^\d+$/',
166 'export' => TRUE,
167 'table_name' => 'civicrm_contribution_soft',
168 'entity' => 'ContributionSoft',
169 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
170 'localizable' => 0,
171 'FKClassName' => 'CRM_Contact_DAO_Contact',
172 ],
173 'amount' => [
174 'name' => 'amount',
175 'type' => CRM_Utils_Type::T_MONEY,
176 'title' => ts('Soft Contribution Amount'),
177 'description' => 'Amount of this soft contribution.',
178 'required' => TRUE,
179 'precision' => [
180 20,
181 2
182 ],
183 'import' => TRUE,
184 'where' => 'civicrm_contribution_soft.amount',
185 'headerPattern' => '/total(.?am(ou)?nt)?/i',
186 'dataPattern' => '/^\d+(\.\d{2})?$/',
187 'export' => TRUE,
188 'table_name' => 'civicrm_contribution_soft',
189 'entity' => 'ContributionSoft',
190 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
191 'localizable' => 0,
192 ],
193 'currency' => [
194 'name' => 'currency',
195 'type' => CRM_Utils_Type::T_STRING,
196 'title' => ts('Soft Contribution Currency'),
197 'description' => '3 character string, value from config setting or input via user.',
198 'maxlength' => 3,
199 'size' => CRM_Utils_Type::FOUR,
200 'default' => 'NULL',
201 'table_name' => 'civicrm_contribution_soft',
202 'entity' => 'ContributionSoft',
203 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
204 'localizable' => 0,
205 'html' => [
206 'type' => 'Select',
207 ],
208 'pseudoconstant' => [
209 'table' => 'civicrm_currency',
210 'keyColumn' => 'name',
211 'labelColumn' => 'full_name',
212 'nameColumn' => 'name',
213 ]
214 ],
215 'pcp_id' => [
216 'name' => 'pcp_id',
217 'type' => CRM_Utils_Type::T_INT,
218 'title' => ts('Soft Contribution PCP'),
219 'description' => 'FK to civicrm_pcp.id',
220 'default' => 'NULL',
221 'table_name' => 'civicrm_contribution_soft',
222 'entity' => 'ContributionSoft',
223 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
224 'localizable' => 0,
225 'FKClassName' => 'CRM_PCP_DAO_PCP',
226 'pseudoconstant' => [
227 'table' => 'civicrm_pcp',
228 'keyColumn' => 'id',
229 'labelColumn' => 'title',
230 ]
231 ],
232 'pcp_display_in_roll' => [
233 'name' => 'pcp_display_in_roll',
234 'type' => CRM_Utils_Type::T_BOOLEAN,
235 'title' => ts('Soft Contribution Display on PCP'),
236 'table_name' => 'civicrm_contribution_soft',
237 'entity' => 'ContributionSoft',
238 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
239 'localizable' => 0,
240 ],
241 'pcp_roll_nickname' => [
242 'name' => 'pcp_roll_nickname',
243 'type' => CRM_Utils_Type::T_STRING,
244 'title' => ts('Soft Contribution PCP Nickname'),
245 'maxlength' => 255,
246 'size' => CRM_Utils_Type::HUGE,
247 'default' => 'NULL',
248 'table_name' => 'civicrm_contribution_soft',
249 'entity' => 'ContributionSoft',
250 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
251 'localizable' => 0,
252 ],
253 'pcp_personal_note' => [
254 'name' => 'pcp_personal_note',
255 'type' => CRM_Utils_Type::T_STRING,
256 'title' => ts('Soft Contribution PCP Note'),
257 'maxlength' => 255,
258 'size' => CRM_Utils_Type::HUGE,
259 'default' => 'NULL',
260 'table_name' => 'civicrm_contribution_soft',
261 'entity' => 'ContributionSoft',
262 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
263 'localizable' => 0,
264 ],
265 'soft_credit_type_id' => [
266 'name' => 'soft_credit_type_id',
267 'type' => CRM_Utils_Type::T_INT,
268 'title' => ts('Soft Credit Type'),
269 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.',
270 'default' => 'NULL',
271 'table_name' => 'civicrm_contribution_soft',
272 'entity' => 'ContributionSoft',
273 'bao' => 'CRM_Contribute_BAO_ContributionSoft',
274 'localizable' => 0,
275 'pseudoconstant' => [
276 'optionGroupName' => 'soft_credit_type',
277 'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
278 ]
279 ],
280 ];
281 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
282 }
283 return Civi::$statics[__CLASS__]['fields'];
284 }
285
286 /**
287 * Return a mapping from field-name to the corresponding key (as used in fields()).
288 *
289 * @return array
290 * Array(string $name => string $uniqueName).
291 */
292 public static function &fieldKeys() {
293 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
294 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
295 }
296 return Civi::$statics[__CLASS__]['fieldKeys'];
297 }
298
299 /**
300 * Returns the names of this table
301 *
302 * @return string
303 */
304 public static function getTableName() {
305 return self::$_tableName;
306 }
307
308 /**
309 * Returns if this table needs to be logged
310 *
311 * @return bool
312 */
313 public function getLog() {
314 return self::$_log;
315 }
316
317 /**
318 * Returns the list of fields that can be imported
319 *
320 * @param bool $prefix
321 *
322 * @return array
323 */
324 public static function &import($prefix = FALSE) {
325 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, []);
326 return $r;
327 }
328
329 /**
330 * Returns the list of fields that can be exported
331 *
332 * @param bool $prefix
333 *
334 * @return array
335 */
336 public static function &export($prefix = FALSE) {
337 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, []);
338 return $r;
339 }
340
341 /**
342 * Returns the list of indices
343 *
344 * @param bool $localize
345 *
346 * @return array
347 */
348 public static function indices($localize = TRUE) {
349 $indices = [
350 'index_id' => [
351 'name' => 'index_id',
352 'field' => [
353 0 => 'pcp_id',
354 ],
355 'localizable' => FALSE,
356 'sig' => 'civicrm_contribution_soft::0::pcp_id',
357 ],
358 ];
359 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
360 }
361
362 }