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:286225e46c4e2f3c12b17cd5f83b210d)
13 * Database access object for the PCP entity.
15 class CRM_PCP_DAO_PCP
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_pcp';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
34 * Personal Campaign Page ID
70 public $donate_link_text;
73 * The Contribution or Event Page which triggered this pcp
80 * The type of PCP this is: contribute or event
87 * The pcp block that this pcp page was created from
96 public $is_thermometer;
101 public $is_honor_roll;
104 * Goal amount of this Personal Campaign Page.
111 * 3 character string, value from config setting or input via user.
118 * Is Personal Campaign Page enabled/active?
125 * Notify owner via email when someone donates to page?
134 public function __construct() {
135 $this->__table
= 'civicrm_pcp';
136 parent
::__construct();
140 * Returns localized title of this entity.
142 public static function getEntityTitle() {
147 * Returns foreign keys and entity references.
150 * [CRM_Core_Reference_Interface]
152 public static function getReferenceColumns() {
153 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
154 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
155 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
156 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
158 return Civi
::$statics[__CLASS__
]['links'];
162 * Returns all the column names of this table
166 public static function &fields() {
167 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
168 Civi
::$statics[__CLASS__
]['fields'] = [
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Personal Campaign Page ID'),
173 'description' => ts('Personal Campaign Page ID'),
175 'where' => 'civicrm_pcp.id',
176 'table_name' => 'civicrm_pcp',
178 'bao' => 'CRM_PCP_BAO_PCP',
182 'pcp_contact_id' => [
183 'name' => 'contact_id',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Contact ID'),
186 'description' => ts('FK to Contact ID'),
188 'where' => 'civicrm_pcp.contact_id',
189 'table_name' => 'civicrm_pcp',
191 'bao' => 'CRM_PCP_BAO_PCP',
193 'FKClassName' => 'CRM_Contact_DAO_Contact',
195 'type' => 'EntityRef',
200 'name' => 'status_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Personal Campaign Page Status'),
204 'where' => 'civicrm_pcp.status_id',
205 'table_name' => 'civicrm_pcp',
207 'bao' => 'CRM_PCP_BAO_PCP',
212 'pseudoconstant' => [
213 'optionGroupName' => 'pcp_status',
214 'optionEditPath' => 'civicrm/admin/options/pcp_status',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Personal Campaign Page Title'),
223 'size' => CRM_Utils_Type
::HUGE
,
224 'where' => 'civicrm_pcp.title',
226 'table_name' => 'civicrm_pcp',
228 'bao' => 'CRM_PCP_BAO_PCP',
236 'name' => 'intro_text',
237 'type' => CRM_Utils_Type
::T_TEXT
,
238 'title' => ts('Intro Text'),
239 'where' => 'civicrm_pcp.intro_text',
241 'table_name' => 'civicrm_pcp',
243 'bao' => 'CRM_PCP_BAO_PCP',
246 'type' => 'TextArea',
251 'name' => 'page_text',
252 'type' => CRM_Utils_Type
::T_TEXT
,
253 'title' => ts('Page Text'),
254 'where' => 'civicrm_pcp.page_text',
256 'table_name' => 'civicrm_pcp',
258 'bao' => 'CRM_PCP_BAO_PCP',
261 'type' => 'TextArea',
265 'donate_link_text' => [
266 'name' => 'donate_link_text',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Donate Link Text'),
270 'size' => CRM_Utils_Type
::HUGE
,
271 'where' => 'civicrm_pcp.donate_link_text',
273 'table_name' => 'civicrm_pcp',
275 'bao' => 'CRM_PCP_BAO_PCP',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Contribution Page'),
286 'description' => ts('The Contribution or Event Page which triggered this pcp'),
288 'where' => 'civicrm_pcp.page_id',
289 'table_name' => 'civicrm_pcp',
291 'bao' => 'CRM_PCP_BAO_PCP',
296 'name' => 'page_type',
297 'type' => CRM_Utils_Type
::T_STRING
,
298 'title' => ts('PCP Page Type'),
299 'description' => ts('The type of PCP this is: contribute or event'),
301 'size' => CRM_Utils_Type
::BIG
,
302 'where' => 'civicrm_pcp.page_type',
303 'default' => 'contribute',
304 'table_name' => 'civicrm_pcp',
306 'bao' => 'CRM_PCP_BAO_PCP',
314 'name' => 'pcp_block_id',
315 'type' => CRM_Utils_Type
::T_INT
,
316 'title' => ts('PCP Block'),
317 'description' => ts('The pcp block that this pcp page was created from'),
319 'where' => 'civicrm_pcp.pcp_block_id',
320 'table_name' => 'civicrm_pcp',
322 'bao' => 'CRM_PCP_BAO_PCP',
326 'is_thermometer' => [
327 'name' => 'is_thermometer',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Use Thermometer?'),
330 'where' => 'civicrm_pcp.is_thermometer',
332 'table_name' => 'civicrm_pcp',
334 'bao' => 'CRM_PCP_BAO_PCP',
337 'type' => 'CheckBox',
342 'name' => 'is_honor_roll',
343 'type' => CRM_Utils_Type
::T_INT
,
344 'title' => ts('Show Honor Roll?'),
345 'where' => 'civicrm_pcp.is_honor_roll',
347 'table_name' => 'civicrm_pcp',
349 'bao' => 'CRM_PCP_BAO_PCP',
352 'type' => 'CheckBox',
357 'name' => 'goal_amount',
358 'type' => CRM_Utils_Type
::T_MONEY
,
359 'title' => ts('Goal Amount'),
360 'description' => ts('Goal amount of this Personal Campaign Page.'),
365 'where' => 'civicrm_pcp.goal_amount',
366 'table_name' => 'civicrm_pcp',
368 'bao' => 'CRM_PCP_BAO_PCP',
376 'name' => 'currency',
377 'type' => CRM_Utils_Type
::T_STRING
,
378 'title' => ts('Currency'),
379 'description' => ts('3 character string, value from config setting or input via user.'),
381 'size' => CRM_Utils_Type
::FOUR
,
382 'where' => 'civicrm_pcp.currency',
384 'table_name' => 'civicrm_pcp',
386 'bao' => 'CRM_PCP_BAO_PCP',
391 'pseudoconstant' => [
392 'table' => 'civicrm_currency',
393 'keyColumn' => 'name',
394 'labelColumn' => 'full_name',
395 'nameColumn' => 'name',
396 'abbrColumn' => 'symbol',
401 'name' => 'is_active',
402 'type' => CRM_Utils_Type
::T_BOOLEAN
,
403 'title' => ts('Enabled?'),
404 'description' => ts('Is Personal Campaign Page enabled/active?'),
405 'where' => 'civicrm_pcp.is_active',
407 'table_name' => 'civicrm_pcp',
409 'bao' => 'CRM_PCP_BAO_PCP',
412 'type' => 'CheckBox',
417 'name' => 'is_notify',
418 'type' => CRM_Utils_Type
::T_BOOLEAN
,
419 'title' => ts('Notify Owner?'),
420 'description' => ts('Notify owner via email when someone donates to page?'),
421 'where' => 'civicrm_pcp.is_notify',
423 'table_name' => 'civicrm_pcp',
425 'bao' => 'CRM_PCP_BAO_PCP',
428 'type' => 'CheckBox',
433 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
435 return Civi
::$statics[__CLASS__
]['fields'];
439 * Return a mapping from field-name to the corresponding key (as used in fields()).
442 * Array(string $name => string $uniqueName).
444 public static function &fieldKeys() {
445 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
446 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
448 return Civi
::$statics[__CLASS__
]['fieldKeys'];
452 * Returns the names of this table
456 public static function getTableName() {
457 return self
::$_tableName;
461 * Returns if this table needs to be logged
465 public function getLog() {
470 * Returns the list of fields that can be imported
472 * @param bool $prefix
476 public static function &import($prefix = FALSE) {
477 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pcp', $prefix, []);
482 * Returns the list of fields that can be exported
484 * @param bool $prefix
488 public static function &export($prefix = FALSE) {
489 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pcp', $prefix, []);
494 * Returns the list of indices
496 * @param bool $localize
500 public static function indices($localize = TRUE) {
502 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;