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