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