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:30c5a26e001449a2ace9e530714e833c)
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',
180 'pcp_contact_id' => [
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Contact ID'),
184 'description' => ts('FK to Contact ID'),
186 'where' => 'civicrm_pcp.contact_id',
187 'table_name' => 'civicrm_pcp',
189 'bao' => 'CRM_PCP_BAO_PCP',
191 'FKClassName' => 'CRM_Contact_DAO_Contact',
193 'type' => 'EntityRef',
198 'name' => 'status_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Personal Campaign Page Status'),
202 'where' => 'civicrm_pcp.status_id',
203 'table_name' => 'civicrm_pcp',
205 'bao' => 'CRM_PCP_BAO_PCP',
210 'pseudoconstant' => [
211 'optionGroupName' => 'pcp_status',
212 'optionEditPath' => 'civicrm/admin/options/pcp_status',
218 'type' => CRM_Utils_Type
::T_STRING
,
219 'title' => ts('Personal Campaign Page Title'),
221 'size' => CRM_Utils_Type
::HUGE
,
222 'where' => 'civicrm_pcp.title',
224 'table_name' => 'civicrm_pcp',
226 'bao' => 'CRM_PCP_BAO_PCP',
234 'name' => 'intro_text',
235 'type' => CRM_Utils_Type
::T_TEXT
,
236 'title' => ts('Intro Text'),
237 'where' => 'civicrm_pcp.intro_text',
239 'table_name' => 'civicrm_pcp',
241 'bao' => 'CRM_PCP_BAO_PCP',
244 'type' => 'TextArea',
249 'name' => 'page_text',
250 'type' => CRM_Utils_Type
::T_TEXT
,
251 'title' => ts('Page Text'),
252 'where' => 'civicrm_pcp.page_text',
254 'table_name' => 'civicrm_pcp',
256 'bao' => 'CRM_PCP_BAO_PCP',
259 'type' => 'TextArea',
263 'donate_link_text' => [
264 'name' => 'donate_link_text',
265 'type' => CRM_Utils_Type
::T_STRING
,
266 'title' => ts('Donate Link Text'),
268 'size' => CRM_Utils_Type
::HUGE
,
269 'where' => 'civicrm_pcp.donate_link_text',
271 'table_name' => 'civicrm_pcp',
273 'bao' => 'CRM_PCP_BAO_PCP',
282 'type' => CRM_Utils_Type
::T_INT
,
283 'title' => ts('Contribution Page'),
284 'description' => ts('The Contribution or Event Page which triggered this pcp'),
286 'where' => 'civicrm_pcp.page_id',
287 'table_name' => 'civicrm_pcp',
289 'bao' => 'CRM_PCP_BAO_PCP',
294 'name' => 'page_type',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('PCP Page Type'),
297 'description' => ts('The type of PCP this is: contribute or event'),
299 'size' => CRM_Utils_Type
::BIG
,
300 'where' => 'civicrm_pcp.page_type',
301 'default' => 'contribute',
302 'table_name' => 'civicrm_pcp',
304 'bao' => 'CRM_PCP_BAO_PCP',
312 'name' => 'pcp_block_id',
313 'type' => CRM_Utils_Type
::T_INT
,
314 'title' => ts('PCP Block'),
315 'description' => ts('The pcp block that this pcp page was created from'),
317 'where' => 'civicrm_pcp.pcp_block_id',
318 'table_name' => 'civicrm_pcp',
320 'bao' => 'CRM_PCP_BAO_PCP',
324 'is_thermometer' => [
325 'name' => 'is_thermometer',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('Use Thermometer?'),
328 'where' => 'civicrm_pcp.is_thermometer',
330 'table_name' => 'civicrm_pcp',
332 'bao' => 'CRM_PCP_BAO_PCP',
335 'type' => 'CheckBox',
340 'name' => 'is_honor_roll',
341 'type' => CRM_Utils_Type
::T_INT
,
342 'title' => ts('Show Honor Roll?'),
343 'where' => 'civicrm_pcp.is_honor_roll',
345 'table_name' => 'civicrm_pcp',
347 'bao' => 'CRM_PCP_BAO_PCP',
350 'type' => 'CheckBox',
355 'name' => 'goal_amount',
356 'type' => CRM_Utils_Type
::T_MONEY
,
357 'title' => ts('Goal Amount'),
358 'description' => ts('Goal amount of this Personal Campaign Page.'),
363 'where' => 'civicrm_pcp.goal_amount',
364 'table_name' => 'civicrm_pcp',
366 'bao' => 'CRM_PCP_BAO_PCP',
374 'name' => 'currency',
375 'type' => CRM_Utils_Type
::T_STRING
,
376 'title' => ts('Currency'),
377 'description' => ts('3 character string, value from config setting or input via user.'),
379 'size' => CRM_Utils_Type
::FOUR
,
380 'where' => 'civicrm_pcp.currency',
382 'table_name' => 'civicrm_pcp',
384 'bao' => 'CRM_PCP_BAO_PCP',
389 'pseudoconstant' => [
390 'table' => 'civicrm_currency',
391 'keyColumn' => 'name',
392 'labelColumn' => 'full_name',
393 'nameColumn' => 'name',
394 'abbrColumn' => 'symbol',
399 'name' => 'is_active',
400 'type' => CRM_Utils_Type
::T_BOOLEAN
,
401 'title' => ts('Enabled?'),
402 'description' => ts('Is Personal Campaign Page enabled/active?'),
403 'where' => 'civicrm_pcp.is_active',
405 'table_name' => 'civicrm_pcp',
407 'bao' => 'CRM_PCP_BAO_PCP',
410 'type' => 'CheckBox',
415 'name' => 'is_notify',
416 'type' => CRM_Utils_Type
::T_BOOLEAN
,
417 'title' => ts('Notify Owner?'),
418 'description' => ts('Notify owner via email when someone donates to page?'),
419 'where' => 'civicrm_pcp.is_notify',
421 'table_name' => 'civicrm_pcp',
423 'bao' => 'CRM_PCP_BAO_PCP',
426 'type' => 'CheckBox',
431 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
433 return Civi
::$statics[__CLASS__
]['fields'];
437 * Return a mapping from field-name to the corresponding key (as used in fields()).
440 * Array(string $name => string $uniqueName).
442 public static function &fieldKeys() {
443 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
444 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
446 return Civi
::$statics[__CLASS__
]['fieldKeys'];
450 * Returns the names of this table
454 public static function getTableName() {
455 return self
::$_tableName;
459 * Returns if this table needs to be logged
463 public function getLog() {
468 * Returns the list of fields that can be imported
470 * @param bool $prefix
474 public static function &import($prefix = FALSE) {
475 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
480 * Returns the list of fields that can be exported
482 * @param bool $prefix
486 public static function &export($prefix = FALSE) {
487 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
492 * Returns the list of indices
494 * @param bool $localize
498 public static function indices($localize = TRUE) {
500 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;