Merge pull request #23753 from eileenmcnaughton/import_validate_int
[civicrm-core.git] / CRM / PCP / DAO / PCPBlock.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/PCP/PCPBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
c1e814c7 9 * (GenCodeChecksum:4b4cbd3c471584e645cd442b994b73bb)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the PCPBlock entity.
f41f0342 14 */
e501603b 15class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
d31fb4e3 18 const COMPONENT = 'CiviContribute';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_pcp_block';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b 34 /**
2cbbebe8 35 * PCP block ID
e501603b 36 *
28979d65
CW
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
e501603b
TO
40 */
41 public $id;
c3fc2621 42
e501603b 43 /**
28979d65
CW
44 * @var string|null
45 * (SQL type: varchar(64))
46 * Note that values will be retrieved from the database as a string.
e501603b
TO
47 */
48 public $entity_table;
c3fc2621 49
e501603b
TO
50 /**
51 * FK to civicrm_contribution_page.id OR civicrm_event.id
52 *
28979d65
CW
53 * @var int|string
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
e501603b
TO
56 */
57 public $entity_id;
c3fc2621 58
e501603b
TO
59 /**
60 * The type of entity that this pcp targets
61 *
62 * @var string
28979d65
CW
63 * (SQL type: varchar(255))
64 * Note that values will be retrieved from the database as a string.
e501603b
TO
65 */
66 public $target_entity_type;
c3fc2621 67
e501603b
TO
68 /**
69 * The entity that this pcp targets
70 *
28979d65
CW
71 * @var int|string
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $target_entity_id;
c3fc2621 76
e501603b
TO
77 /**
78 * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
79 *
28979d65
CW
80 * @var int|string|null
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
e501603b
TO
83 */
84 public $supporter_profile_id;
c3fc2621 85
e501603b
TO
86 /**
87 * FK to civicrm_option_group with name = PCP owner notifications
88 *
28979d65
CW
89 * @var int|string|null
90 * (SQL type: int unsigned)
91 * Note that values will be retrieved from the database as a string.
e501603b
TO
92 */
93 public $owner_notify_id;
c3fc2621 94
e501603b
TO
95 /**
96 * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
97 *
c1e814c7 98 * @var bool|string
28979d65
CW
99 * (SQL type: tinyint)
100 * Note that values will be retrieved from the database as a string.
e501603b
TO
101 */
102 public $is_approval_needed;
c3fc2621 103
e501603b
TO
104 /**
105 * Does Personal Campaign Page allow using tell a friend?
106 *
c1e814c7 107 * @var bool|string
28979d65
CW
108 * (SQL type: tinyint)
109 * Note that values will be retrieved from the database as a string.
e501603b
TO
110 */
111 public $is_tellfriend_enabled;
c3fc2621 112
e501603b
TO
113 /**
114 * Maximum recipient fields allowed in tell a friend
115 *
28979d65
CW
116 * @var int|string|null
117 * (SQL type: int unsigned)
118 * Note that values will be retrieved from the database as a string.
e501603b
TO
119 */
120 public $tellfriend_limit;
c3fc2621 121
e501603b
TO
122 /**
123 * Link text for PCP.
124 *
28979d65
CW
125 * @var string|null
126 * (SQL type: varchar(255))
127 * Note that values will be retrieved from the database as a string.
e501603b
TO
128 */
129 public $link_text;
c3fc2621 130
e501603b
TO
131 /**
132 * Is Personal Campaign Page Block enabled/active?
133 *
c1e814c7 134 * @var bool|string
28979d65
CW
135 * (SQL type: tinyint)
136 * Note that values will be retrieved from the database as a string.
e501603b
TO
137 */
138 public $is_active;
c3fc2621 139
e501603b
TO
140 /**
141 * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
142 *
28979d65
CW
143 * @var string|null
144 * (SQL type: varchar(255))
145 * Note that values will be retrieved from the database as a string.
e501603b
TO
146 */
147 public $notify_email;
c3fc2621 148
e501603b 149 /**
f41f0342 150 * Class constructor.
e501603b 151 */
c3fc2621 152 public function __construct() {
e501603b
TO
153 $this->__table = 'civicrm_pcp_block';
154 parent::__construct();
155 }
c3fc2621 156
449c4e6b
CW
157 /**
158 * Returns localized title of this entity.
7b66c3b5
AH
159 *
160 * @param bool $plural
161 * Whether to return the plural version of the title.
449c4e6b 162 */
7b66c3b5
AH
163 public static function getEntityTitle($plural = FALSE) {
164 return $plural ? ts('PCPBlocks') : ts('PCPBlock');
449c4e6b
CW
165 }
166
e501603b 167 /**
f41f0342 168 * Returns foreign keys and entity references.
e501603b
TO
169 *
170 * @return array
171 * [CRM_Core_Reference_Interface]
172 */
c3fc2621 173 public static function getReferenceColumns() {
346aaaba 174 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 175 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
176 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
177 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
178 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
346aaaba 179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 180 }
346aaaba 181 return Civi::$statics[__CLASS__]['links'];
e501603b 182 }
c3fc2621 183
e501603b
TO
184 /**
185 * Returns all the column names of this table
186 *
187 * @return array
188 */
c3fc2621 189 public static function &fields() {
346aaaba 190 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
191 Civi::$statics[__CLASS__]['fields'] = [
192 'id' => [
e501603b
TO
193 'name' => 'id',
194 'type' => CRM_Utils_Type::T_INT,
c3fc2621 195 'title' => ts('PCP Block ID'),
2cbbebe8 196 'description' => ts('PCP block ID'),
c3fc2621 197 'required' => TRUE,
a36434b9 198 'where' => 'civicrm_pcp_block.id',
522a26c9 199 'table_name' => 'civicrm_pcp_block',
200 'entity' => 'PCPBlock',
201 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 202 'localizable' => 0,
2cbbebe8
A
203 'html' => [
204 'type' => 'Number',
205 ],
1fe423d6 206 'readonly' => TRUE,
a9d0587b 207 'add' => '2.2',
c3fc2621
CW
208 ],
209 'entity_table' => [
e501603b
TO
210 'name' => 'entity_table',
211 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 212 'title' => ts('Entity Table'),
e501603b
TO
213 'maxlength' => 64,
214 'size' => CRM_Utils_Type::BIG,
a36434b9 215 'where' => 'civicrm_pcp_block.entity_table',
522a26c9 216 'table_name' => 'civicrm_pcp_block',
217 'entity' => 'PCPBlock',
218 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 219 'localizable' => 0,
a9d0587b 220 'add' => '2.2',
c3fc2621
CW
221 ],
222 'entity_id' => [
e501603b
TO
223 'name' => 'entity_id',
224 'type' => CRM_Utils_Type::T_INT,
c3fc2621 225 'title' => ts('Entity'),
215b423e 226 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
c3fc2621 227 'required' => TRUE,
a36434b9 228 'where' => 'civicrm_pcp_block.entity_id',
522a26c9 229 'table_name' => 'civicrm_pcp_block',
230 'entity' => 'PCPBlock',
231 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 232 'localizable' => 0,
a9d0587b 233 'add' => '2.2',
c3fc2621
CW
234 ],
235 'target_entity_type' => [
e501603b
TO
236 'name' => 'target_entity_type',
237 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 238 'title' => ts('Target Entity'),
215b423e 239 'description' => ts('The type of entity that this pcp targets'),
c3fc2621 240 'required' => TRUE,
e501603b
TO
241 'maxlength' => 255,
242 'size' => CRM_Utils_Type::HUGE,
a36434b9 243 'where' => 'civicrm_pcp_block.target_entity_type',
e501603b 244 'default' => 'contribute',
522a26c9 245 'table_name' => 'civicrm_pcp_block',
246 'entity' => 'PCPBlock',
247 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 248 'localizable' => 0,
a9d0587b 249 'add' => '4.1',
c3fc2621
CW
250 ],
251 'target_entity_id' => [
e501603b
TO
252 'name' => 'target_entity_id',
253 'type' => CRM_Utils_Type::T_INT,
c3fc2621 254 'title' => ts('Target Entity ID'),
215b423e 255 'description' => ts('The entity that this pcp targets'),
c3fc2621 256 'required' => TRUE,
a36434b9 257 'where' => 'civicrm_pcp_block.target_entity_id',
522a26c9 258 'table_name' => 'civicrm_pcp_block',
259 'entity' => 'PCPBlock',
260 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 261 'localizable' => 0,
a9d0587b 262 'add' => '4.1',
c3fc2621
CW
263 ],
264 'supporter_profile_id' => [
e501603b
TO
265 'name' => 'supporter_profile_id',
266 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 267 'title' => ts('Supporter Profile ID'),
215b423e 268 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
a36434b9 269 'where' => 'civicrm_pcp_block.supporter_profile_id',
5fb0de1f 270 'default' => NULL,
522a26c9 271 'table_name' => 'civicrm_pcp_block',
272 'entity' => 'PCPBlock',
273 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 274 'localizable' => 0,
e501603b 275 'FKClassName' => 'CRM_Core_DAO_UFGroup',
2cbbebe8
A
276 'html' => [
277 'label' => ts("Supporter Profile"),
278 ],
a9d0587b 279 'add' => '2.2',
c3fc2621
CW
280 ],
281 'owner_notify_id' => [
e501603b
TO
282 'name' => 'owner_notify_id',
283 'type' => CRM_Utils_Type::T_INT,
c3fc2621 284 'title' => ts('Owner Notification'),
215b423e 285 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
a36434b9 286 'where' => 'civicrm_pcp_block.owner_notify_id',
45a83e42 287 'default' => '0',
522a26c9 288 'table_name' => 'civicrm_pcp_block',
289 'entity' => 'PCPBlock',
290 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 291 'localizable' => 0,
c3fc2621 292 'html' => [
e501603b 293 'type' => 'Radio',
c3fc2621
CW
294 ],
295 'pseudoconstant' => [
e501603b
TO
296 'optionGroupName' => 'pcp_owner_notify',
297 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
e6ca0a57 298 ],
a9d0587b 299 'add' => '4.6',
c3fc2621
CW
300 ],
301 'is_approval_needed' => [
e501603b
TO
302 'name' => 'is_approval_needed',
303 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 304 'title' => ts('Approval Required?'),
215b423e 305 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
c1e814c7 306 'required' => TRUE,
a36434b9 307 'where' => 'civicrm_pcp_block.is_approval_needed',
c1e814c7 308 'default' => '0',
522a26c9 309 'table_name' => 'civicrm_pcp_block',
310 'entity' => 'PCPBlock',
311 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 312 'localizable' => 0,
a9d0587b 313 'add' => '2.2',
c3fc2621
CW
314 ],
315 'is_tellfriend_enabled' => [
e501603b
TO
316 'name' => 'is_tellfriend_enabled',
317 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 318 'title' => ts('Tell a Friend Enabled?'),
215b423e 319 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
c1e814c7 320 'required' => TRUE,
a36434b9 321 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
c1e814c7 322 'default' => '0',
522a26c9 323 'table_name' => 'civicrm_pcp_block',
324 'entity' => 'PCPBlock',
325 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 326 'localizable' => 0,
a9d0587b 327 'add' => '2.2',
c3fc2621
CW
328 ],
329 'tellfriend_limit' => [
e501603b
TO
330 'name' => 'tellfriend_limit',
331 'type' => CRM_Utils_Type::T_INT,
c3fc2621 332 'title' => ts('Tell A Friend Limit'),
215b423e 333 'description' => ts('Maximum recipient fields allowed in tell a friend'),
a36434b9 334 'where' => 'civicrm_pcp_block.tellfriend_limit',
5fb0de1f 335 'default' => NULL,
522a26c9 336 'table_name' => 'civicrm_pcp_block',
337 'entity' => 'PCPBlock',
338 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 339 'localizable' => 0,
a9d0587b 340 'add' => '2.2',
c3fc2621
CW
341 ],
342 'link_text' => [
e501603b
TO
343 'name' => 'link_text',
344 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 345 'title' => ts('Link Text'),
215b423e 346 'description' => ts('Link text for PCP.'),
e501603b
TO
347 'maxlength' => 255,
348 'size' => CRM_Utils_Type::HUGE,
a36434b9 349 'where' => 'civicrm_pcp_block.link_text',
5fb0de1f 350 'default' => NULL,
522a26c9 351 'table_name' => 'civicrm_pcp_block',
352 'entity' => 'PCPBlock',
353 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 354 'localizable' => 1,
a9d0587b 355 'add' => '2.2',
c3fc2621
CW
356 ],
357 'is_active' => [
e501603b
TO
358 'name' => 'is_active',
359 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 360 'title' => ts('Enabled?'),
215b423e 361 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
c1e814c7 362 'required' => TRUE,
a36434b9 363 'where' => 'civicrm_pcp_block.is_active',
e501603b 364 'default' => '1',
522a26c9 365 'table_name' => 'civicrm_pcp_block',
366 'entity' => 'PCPBlock',
367 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 368 'localizable' => 0,
a9d0587b 369 'add' => '2.2',
c3fc2621
CW
370 ],
371 'notify_email' => [
e501603b
TO
372 'name' => 'notify_email',
373 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 374 'title' => ts('Notification Email'),
215b423e 375 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
e501603b
TO
376 'maxlength' => 255,
377 'size' => CRM_Utils_Type::HUGE,
a36434b9 378 'where' => 'civicrm_pcp_block.notify_email',
5fb0de1f 379 'default' => NULL,
522a26c9 380 'table_name' => 'civicrm_pcp_block',
381 'entity' => 'PCPBlock',
382 'bao' => 'CRM_PCP_BAO_PCPBlock',
6a7e5e5d 383 'localizable' => 0,
a9d0587b 384 'add' => '2.2',
c3fc2621
CW
385 ],
386 ];
346aaaba 387 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 388 }
346aaaba 389 return Civi::$statics[__CLASS__]['fields'];
e501603b 390 }
c3fc2621 391
e501603b 392 /**
bd8e0b14 393 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
394 *
395 * @return array
bd8e0b14 396 * Array(string $name => string $uniqueName).
e501603b 397 */
c3fc2621 398 public static function &fieldKeys() {
bd8e0b14
TO
399 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
400 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 401 }
bd8e0b14 402 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 403 }
c3fc2621 404
e501603b
TO
405 /**
406 * Returns the names of this table
407 *
408 * @return string
409 */
c3fc2621 410 public static function getTableName() {
e501603b
TO
411 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
412 }
c3fc2621 413
e501603b
TO
414 /**
415 * Returns if this table needs to be logged
416 *
c3fc2621 417 * @return bool
e501603b 418 */
c3fc2621 419 public function getLog() {
e501603b
TO
420 return self::$_log;
421 }
c3fc2621 422
e501603b
TO
423 /**
424 * Returns the list of fields that can be imported
425 *
426 * @param bool $prefix
427 *
428 * @return array
429 */
c3fc2621
CW
430 public static function &import($prefix = FALSE) {
431 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []);
60808919 432 return $r;
e501603b 433 }
c3fc2621 434
e501603b
TO
435 /**
436 * Returns the list of fields that can be exported
437 *
438 * @param bool $prefix
439 *
440 * @return array
441 */
c3fc2621
CW
442 public static function &export($prefix = FALSE) {
443 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []);
60808919 444 return $r;
e501603b 445 }
c3fc2621 446
e7a6b91a
AS
447 /**
448 * Returns the list of indices
c3fc2621
CW
449 *
450 * @param bool $localize
451 *
452 * @return array
e7a6b91a
AS
453 */
454 public static function indices($localize = TRUE) {
c3fc2621 455 $indices = [];
e7a6b91a
AS
456 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
457 }
c3fc2621 458
e501603b 459}