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