Merge pull request #17732 from civicrm/5.27
[civicrm-core.git] / CRM / PCP / DAO / PCP.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cbc0ec5e899ec81538d2a54f44281856)
10 */
11
12 /**
13 * Database access object for the PCP entity.
14 */
15 class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_pcp';
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 * Personal Campaign Page ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * @var int
47 */
48 public $status_id;
49
50 /**
51 * @var string
52 */
53 public $title;
54
55 /**
56 * @var text
57 */
58 public $intro_text;
59
60 /**
61 * @var text
62 */
63 public $page_text;
64
65 /**
66 * @var string
67 */
68 public $donate_link_text;
69
70 /**
71 * The Contribution or Event Page which triggered this pcp
72 *
73 * @var int
74 */
75 public $page_id;
76
77 /**
78 * The type of PCP this is: contribute or event
79 *
80 * @var string
81 */
82 public $page_type;
83
84 /**
85 * The pcp block that this pcp page was created from
86 *
87 * @var int
88 */
89 public $pcp_block_id;
90
91 /**
92 * @var int
93 */
94 public $is_thermometer;
95
96 /**
97 * @var int
98 */
99 public $is_honor_roll;
100
101 /**
102 * Goal amount of this Personal Campaign Page.
103 *
104 * @var float
105 */
106 public $goal_amount;
107
108 /**
109 * 3 character string, value from config setting or input via user.
110 *
111 * @var string
112 */
113 public $currency;
114
115 /**
116 * Is Personal Campaign Page enabled/active?
117 *
118 * @var bool
119 */
120 public $is_active;
121
122 /**
123 * Notify owner via email when someone donates to page?
124 *
125 * @var bool
126 */
127 public $is_notify;
128
129 /**
130 * Class constructor.
131 */
132 public function __construct() {
133 $this->__table = 'civicrm_pcp';
134 parent::__construct();
135 }
136
137 /**
138 * Returns localized title of this entity.
139 */
140 public static function getEntityTitle() {
141 return ts('PCPs');
142 }
143
144 /**
145 * Returns foreign keys and entity references.
146 *
147 * @return array
148 * [CRM_Core_Reference_Interface]
149 */
150 public static function getReferenceColumns() {
151 if (!isset(Civi::$statics[__CLASS__]['links'])) {
152 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
153 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
154 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
155 }
156 return Civi::$statics[__CLASS__]['links'];
157 }
158
159 /**
160 * Returns all the column names of this table
161 *
162 * @return array
163 */
164 public static function &fields() {
165 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
166 Civi::$statics[__CLASS__]['fields'] = [
167 'pcp_id' => [
168 'name' => 'id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Personal Campaign Page ID'),
171 'description' => ts('Personal Campaign Page ID'),
172 'required' => TRUE,
173 'where' => 'civicrm_pcp.id',
174 'table_name' => 'civicrm_pcp',
175 'entity' => 'PCP',
176 'bao' => 'CRM_PCP_BAO_PCP',
177 'localizable' => 0,
178 ],
179 'pcp_contact_id' => [
180 'name' => 'contact_id',
181 'type' => CRM_Utils_Type::T_INT,
182 'title' => ts('Contact ID'),
183 'description' => ts('FK to Contact ID'),
184 'required' => TRUE,
185 'where' => 'civicrm_pcp.contact_id',
186 'table_name' => 'civicrm_pcp',
187 'entity' => 'PCP',
188 'bao' => 'CRM_PCP_BAO_PCP',
189 'localizable' => 0,
190 'FKClassName' => 'CRM_Contact_DAO_Contact',
191 'html' => [
192 'type' => 'EntityRef',
193 ],
194 ],
195 'status_id' => [
196 'name' => 'status_id',
197 'type' => CRM_Utils_Type::T_INT,
198 'title' => ts('Personal Campaign Page Status'),
199 'required' => TRUE,
200 'where' => 'civicrm_pcp.status_id',
201 'table_name' => 'civicrm_pcp',
202 'entity' => 'PCP',
203 'bao' => 'CRM_PCP_BAO_PCP',
204 'localizable' => 0,
205 'html' => [
206 'type' => 'Select',
207 ],
208 'pseudoconstant' => [
209 'optionGroupName' => 'pcp_status',
210 'optionEditPath' => 'civicrm/admin/options/pcp_status',
211 ],
212 ],
213 'title' => [
214 'name' => 'title',
215 'type' => CRM_Utils_Type::T_STRING,
216 'title' => ts('Personal Campaign Page Title'),
217 'maxlength' => 255,
218 'size' => CRM_Utils_Type::HUGE,
219 'where' => 'civicrm_pcp.title',
220 'default' => 'NULL',
221 'table_name' => 'civicrm_pcp',
222 'entity' => 'PCP',
223 'bao' => 'CRM_PCP_BAO_PCP',
224 'localizable' => 0,
225 'html' => [
226 'type' => 'Text',
227 ],
228 ],
229 'intro_text' => [
230 'name' => 'intro_text',
231 'type' => CRM_Utils_Type::T_TEXT,
232 'title' => ts('Intro Text'),
233 'where' => 'civicrm_pcp.intro_text',
234 'default' => 'NULL',
235 'table_name' => 'civicrm_pcp',
236 'entity' => 'PCP',
237 'bao' => 'CRM_PCP_BAO_PCP',
238 'localizable' => 0,
239 'html' => [
240 'type' => 'TextArea',
241 ],
242 ],
243 'page_text' => [
244 'name' => 'page_text',
245 'type' => CRM_Utils_Type::T_TEXT,
246 'title' => ts('Page Text'),
247 'where' => 'civicrm_pcp.page_text',
248 'default' => 'NULL',
249 'table_name' => 'civicrm_pcp',
250 'entity' => 'PCP',
251 'bao' => 'CRM_PCP_BAO_PCP',
252 'localizable' => 0,
253 'html' => [
254 'type' => 'TextArea',
255 ],
256 ],
257 'donate_link_text' => [
258 'name' => 'donate_link_text',
259 'type' => CRM_Utils_Type::T_STRING,
260 'title' => ts('Donate Link Text'),
261 'maxlength' => 255,
262 'size' => CRM_Utils_Type::HUGE,
263 'where' => 'civicrm_pcp.donate_link_text',
264 'default' => 'NULL',
265 'table_name' => 'civicrm_pcp',
266 'entity' => 'PCP',
267 'bao' => 'CRM_PCP_BAO_PCP',
268 'localizable' => 0,
269 'html' => [
270 'type' => 'Text',
271 ],
272 ],
273 'page_id' => [
274 'name' => 'page_id',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Contribution Page'),
277 'description' => ts('The Contribution or Event Page which triggered this pcp'),
278 'required' => TRUE,
279 'where' => 'civicrm_pcp.page_id',
280 'table_name' => 'civicrm_pcp',
281 'entity' => 'PCP',
282 'bao' => 'CRM_PCP_BAO_PCP',
283 'localizable' => 0,
284 ],
285 'page_type' => [
286 'name' => 'page_type',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('PCP Page Type'),
289 'description' => ts('The type of PCP this is: contribute or event'),
290 'maxlength' => 64,
291 'size' => CRM_Utils_Type::BIG,
292 'where' => 'civicrm_pcp.page_type',
293 'default' => 'contribute',
294 'table_name' => 'civicrm_pcp',
295 'entity' => 'PCP',
296 'bao' => 'CRM_PCP_BAO_PCP',
297 'localizable' => 0,
298 'html' => [
299 'type' => 'Select',
300 ],
301 ],
302 'pcp_block_id' => [
303 'name' => 'pcp_block_id',
304 'type' => CRM_Utils_Type::T_INT,
305 'title' => ts('PCP Block'),
306 'description' => ts('The pcp block that this pcp page was created from'),
307 'required' => TRUE,
308 'where' => 'civicrm_pcp.pcp_block_id',
309 'table_name' => 'civicrm_pcp',
310 'entity' => 'PCP',
311 'bao' => 'CRM_PCP_BAO_PCP',
312 'localizable' => 0,
313 ],
314 'is_thermometer' => [
315 'name' => 'is_thermometer',
316 'type' => CRM_Utils_Type::T_INT,
317 'title' => ts('Use Thermometer?'),
318 'where' => 'civicrm_pcp.is_thermometer',
319 'default' => '0',
320 'table_name' => 'civicrm_pcp',
321 'entity' => 'PCP',
322 'bao' => 'CRM_PCP_BAO_PCP',
323 'localizable' => 0,
324 'html' => [
325 'type' => 'CheckBox',
326 ],
327 ],
328 'is_honor_roll' => [
329 'name' => 'is_honor_roll',
330 'type' => CRM_Utils_Type::T_INT,
331 'title' => ts('Show Honor Roll?'),
332 'where' => 'civicrm_pcp.is_honor_roll',
333 'default' => '0',
334 'table_name' => 'civicrm_pcp',
335 'entity' => 'PCP',
336 'bao' => 'CRM_PCP_BAO_PCP',
337 'localizable' => 0,
338 'html' => [
339 'type' => 'CheckBox',
340 ],
341 ],
342 'goal_amount' => [
343 'name' => 'goal_amount',
344 'type' => CRM_Utils_Type::T_MONEY,
345 'title' => ts('Goal Amount'),
346 'description' => ts('Goal amount of this Personal Campaign Page.'),
347 'precision' => [
348 20,
349 2,
350 ],
351 'where' => 'civicrm_pcp.goal_amount',
352 'table_name' => 'civicrm_pcp',
353 'entity' => 'PCP',
354 'bao' => 'CRM_PCP_BAO_PCP',
355 'localizable' => 0,
356 'html' => [
357 'type' => 'Text',
358 ],
359 ],
360 'currency' => [
361 'name' => 'currency',
362 'type' => CRM_Utils_Type::T_STRING,
363 'title' => ts('Currency'),
364 'description' => ts('3 character string, value from config setting or input via user.'),
365 'maxlength' => 3,
366 'size' => CRM_Utils_Type::FOUR,
367 'where' => 'civicrm_pcp.currency',
368 'default' => 'NULL',
369 'table_name' => 'civicrm_pcp',
370 'entity' => 'PCP',
371 'bao' => 'CRM_PCP_BAO_PCP',
372 'localizable' => 0,
373 'html' => [
374 'type' => 'Select',
375 ],
376 'pseudoconstant' => [
377 'table' => 'civicrm_currency',
378 'keyColumn' => 'name',
379 'labelColumn' => 'full_name',
380 'nameColumn' => 'name',
381 'abbrColumn' => 'symbol',
382 ],
383 ],
384 'is_active' => [
385 'name' => 'is_active',
386 'type' => CRM_Utils_Type::T_BOOLEAN,
387 'title' => ts('Enabled?'),
388 'description' => ts('Is Personal Campaign Page enabled/active?'),
389 'where' => 'civicrm_pcp.is_active',
390 'default' => '0',
391 'table_name' => 'civicrm_pcp',
392 'entity' => 'PCP',
393 'bao' => 'CRM_PCP_BAO_PCP',
394 'localizable' => 0,
395 'html' => [
396 'type' => 'CheckBox',
397 ],
398 ],
399 'is_notify' => [
400 'name' => 'is_notify',
401 'type' => CRM_Utils_Type::T_BOOLEAN,
402 'title' => ts('Notify Owner?'),
403 'description' => ts('Notify owner via email when someone donates to page?'),
404 'where' => 'civicrm_pcp.is_notify',
405 'default' => '0',
406 'table_name' => 'civicrm_pcp',
407 'entity' => 'PCP',
408 'bao' => 'CRM_PCP_BAO_PCP',
409 'localizable' => 0,
410 'html' => [
411 'type' => 'CheckBox',
412 ],
413 ],
414 ];
415 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
416 }
417 return Civi::$statics[__CLASS__]['fields'];
418 }
419
420 /**
421 * Return a mapping from field-name to the corresponding key (as used in fields()).
422 *
423 * @return array
424 * Array(string $name => string $uniqueName).
425 */
426 public static function &fieldKeys() {
427 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
428 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
429 }
430 return Civi::$statics[__CLASS__]['fieldKeys'];
431 }
432
433 /**
434 * Returns the names of this table
435 *
436 * @return string
437 */
438 public static function getTableName() {
439 return self::$_tableName;
440 }
441
442 /**
443 * Returns if this table needs to be logged
444 *
445 * @return bool
446 */
447 public function getLog() {
448 return self::$_log;
449 }
450
451 /**
452 * Returns the list of fields that can be imported
453 *
454 * @param bool $prefix
455 *
456 * @return array
457 */
458 public static function &import($prefix = FALSE) {
459 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []);
460 return $r;
461 }
462
463 /**
464 * Returns the list of fields that can be exported
465 *
466 * @param bool $prefix
467 *
468 * @return array
469 */
470 public static function &export($prefix = FALSE) {
471 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []);
472 return $r;
473 }
474
475 /**
476 * Returns the list of indices
477 *
478 * @param bool $localize
479 *
480 * @return array
481 */
482 public static function indices($localize = TRUE) {
483 $indices = [];
484 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
485 }
486
487 }