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