5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/PCP/PCP.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cbc0ec5e899ec81538d2a54f44281856)
13 * Database access object for the PCP entity.
15 class CRM_PCP_DAO_PCP
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_pcp';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
32 * Personal Campaign Page ID
68 public $donate_link_text;
71 * The Contribution or Event Page which triggered this pcp
78 * The type of PCP this is: contribute or event
85 * The pcp block that this pcp page was created from
94 public $is_thermometer;
99 public $is_honor_roll;
102 * Goal amount of this Personal Campaign Page.
109 * 3 character string, value from config setting or input via user.
116 * Is Personal Campaign Page enabled/active?
123 * Notify owner via email when someone donates to page?
132 public function __construct() {
133 $this->__table
= 'civicrm_pcp';
134 parent
::__construct();
138 * Returns localized title of this entity.
140 public static function getEntityTitle() {
145 * Returns foreign keys and entity references.
148 * [CRM_Core_Reference_Interface]
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']);
156 return Civi
::$statics[__CLASS__
]['links'];
160 * Returns all the column names of this table
164 public static function &fields() {
165 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
166 Civi
::$statics[__CLASS__
]['fields'] = [
169 'type' => CRM_Utils_Type
::T_INT
,
170 'title' => ts('Personal Campaign Page ID'),
171 'description' => ts('Personal Campaign Page ID'),
173 'where' => 'civicrm_pcp.id',
174 'table_name' => 'civicrm_pcp',
176 'bao' => 'CRM_PCP_BAO_PCP',
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'),
185 'where' => 'civicrm_pcp.contact_id',
186 'table_name' => 'civicrm_pcp',
188 'bao' => 'CRM_PCP_BAO_PCP',
190 'FKClassName' => 'CRM_Contact_DAO_Contact',
192 'type' => 'EntityRef',
196 'name' => 'status_id',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Personal Campaign Page Status'),
200 'where' => 'civicrm_pcp.status_id',
201 'table_name' => 'civicrm_pcp',
203 'bao' => 'CRM_PCP_BAO_PCP',
208 'pseudoconstant' => [
209 'optionGroupName' => 'pcp_status',
210 'optionEditPath' => 'civicrm/admin/options/pcp_status',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Personal Campaign Page Title'),
218 'size' => CRM_Utils_Type
::HUGE
,
219 'where' => 'civicrm_pcp.title',
221 'table_name' => 'civicrm_pcp',
223 'bao' => 'CRM_PCP_BAO_PCP',
230 'name' => 'intro_text',
231 'type' => CRM_Utils_Type
::T_TEXT
,
232 'title' => ts('Intro Text'),
233 'where' => 'civicrm_pcp.intro_text',
235 'table_name' => 'civicrm_pcp',
237 'bao' => 'CRM_PCP_BAO_PCP',
240 'type' => 'TextArea',
244 'name' => 'page_text',
245 'type' => CRM_Utils_Type
::T_TEXT
,
246 'title' => ts('Page Text'),
247 'where' => 'civicrm_pcp.page_text',
249 'table_name' => 'civicrm_pcp',
251 'bao' => 'CRM_PCP_BAO_PCP',
254 'type' => 'TextArea',
257 'donate_link_text' => [
258 'name' => 'donate_link_text',
259 'type' => CRM_Utils_Type
::T_STRING
,
260 'title' => ts('Donate Link Text'),
262 'size' => CRM_Utils_Type
::HUGE
,
263 'where' => 'civicrm_pcp.donate_link_text',
265 'table_name' => 'civicrm_pcp',
267 'bao' => 'CRM_PCP_BAO_PCP',
275 'type' => CRM_Utils_Type
::T_INT
,
276 'title' => ts('Contribution Page'),
277 'description' => ts('The Contribution or Event Page which triggered this pcp'),
279 'where' => 'civicrm_pcp.page_id',
280 'table_name' => 'civicrm_pcp',
282 'bao' => 'CRM_PCP_BAO_PCP',
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'),
291 'size' => CRM_Utils_Type
::BIG
,
292 'where' => 'civicrm_pcp.page_type',
293 'default' => 'contribute',
294 'table_name' => 'civicrm_pcp',
296 'bao' => 'CRM_PCP_BAO_PCP',
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'),
308 'where' => 'civicrm_pcp.pcp_block_id',
309 'table_name' => 'civicrm_pcp',
311 'bao' => 'CRM_PCP_BAO_PCP',
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',
320 'table_name' => 'civicrm_pcp',
322 'bao' => 'CRM_PCP_BAO_PCP',
325 'type' => 'CheckBox',
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',
334 'table_name' => 'civicrm_pcp',
336 'bao' => 'CRM_PCP_BAO_PCP',
339 'type' => 'CheckBox',
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.'),
351 'where' => 'civicrm_pcp.goal_amount',
352 'table_name' => 'civicrm_pcp',
354 'bao' => 'CRM_PCP_BAO_PCP',
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.'),
366 'size' => CRM_Utils_Type
::FOUR
,
367 'where' => 'civicrm_pcp.currency',
369 'table_name' => 'civicrm_pcp',
371 'bao' => 'CRM_PCP_BAO_PCP',
376 'pseudoconstant' => [
377 'table' => 'civicrm_currency',
378 'keyColumn' => 'name',
379 'labelColumn' => 'full_name',
380 'nameColumn' => 'name',
381 'abbrColumn' => 'symbol',
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',
391 'table_name' => 'civicrm_pcp',
393 'bao' => 'CRM_PCP_BAO_PCP',
396 'type' => 'CheckBox',
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',
406 'table_name' => 'civicrm_pcp',
408 'bao' => 'CRM_PCP_BAO_PCP',
411 'type' => 'CheckBox',
415 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
417 return Civi
::$statics[__CLASS__
]['fields'];
421 * Return a mapping from field-name to the corresponding key (as used in fields()).
424 * Array(string $name => string $uniqueName).
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()));
430 return Civi
::$statics[__CLASS__
]['fieldKeys'];
434 * Returns the names of this table
438 public static function getTableName() {
439 return self
::$_tableName;
443 * Returns if this table needs to be logged
447 public function getLog() {
452 * Returns the list of fields that can be imported
454 * @param bool $prefix
458 public static function &import($prefix = FALSE) {
459 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
464 * Returns the list of fields that can be exported
466 * @param bool $prefix
470 public static function &export($prefix = FALSE) {
471 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
476 * Returns the list of indices
478 * @param bool $localize
482 public static function indices($localize = TRUE) {
484 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;